WPF Popups

412 views
Skip to first unread message

Sergey Zhilyakov

unread,
Jan 9, 2014, 6:18:43 PM1/9/14
to exce...@googlegroups.com
Hi,

first, I would thank you for such a great project as ExcelDna. It works just perfect. The problem below probably relates to Excel rather then ExcelDna. Nevertheless, I have to ask.

I have the CTP with ElementHost hosting WPF user control. All works well except popups. Here are a few observations:
  1. If the edges of the popup are inside CTP, all works well.
  2. If a part of the popup is drawn outside CTP (this happens when the width of popup is greater than the width of CTP, see below) and I click 'outside' part of the popup, it disappears.
  3. I tried all suggestions from here with no success.
  4. The problem appears only in Excel 2007/2010. In Excel 2013 all works well.
  5. The problem does not appear if the popup is in the modeless dialog box.
I noticed that if I push left mouse button within 'outside' area and do not release it, CTP looses focus first.

Do you have an idea what may go wrong here?


Thanks in advance,
Sergey

Jiri Pik

unread,
Jan 9, 2014, 10:34:46 PM1/9/14
to exce...@googlegroups.com

I suggest you to take care of the closing of the PopUp manually.

 

<Popup Name="ZZZToolTip" StaysOpen="True" AllowsTransparency="True" MaxWidth="600" Placement="MousePoint" PopupAnimation="Fade" >

 

And then to listen on mouse enter to all other components and hide the popup there.

 

<telerik:GridViewDataColumn Header="XXX" DataMemberBinding="{Binding XXX}">

                                    <telerik:GridViewColumn.CellTemplate>

                                        <DataTemplate>

                                            <TextBlock Text="{Binding XXX }">

                                                <TextBlock.Style>

                                                    <Style TargetType="{x:Type TextBlock}">

                                                        <EventSetter Event="Mouse.MouseEnter" Handler="ZZZide_PopupToolTip" />

                                                        <EventSetter Event="Mouse.MouseLeave" Handler="ZZZHide_PopupToolTip"/>

                                                    </Style>

                                                </TextBlock.Style>

                                            </TextBlock>

                                        </DataTemplate>

                                    </telerik:GridViewColumn.CellTemplate>

                                </telerik:GridViewDataColumn>

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at http://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/groups/opt_out.

Sergey Zhilyakov

unread,
Jan 13, 2014, 1:29:40 PM1/13/14
to exce...@googlegroups.com
Thanks for the reply.

Unfortunately, this does not work. The MouseLeave event does not raise sometimes when leaving the popup. I also tried approaches described here http://stackoverflow.com/questions/619798/why-does-a-wpf-popup-close-when-its-background-area-is-clicked with no luck.

Interestingly, popups behaves as expected in Excel 2013. I'm still thinking that the problem relates to Excel 2007/2010 and I'm still unable to work around this.

Best regards,
Sergey

Jiri Pik

unread,
Jan 14, 2014, 8:45:07 AM1/14/14
to exce...@googlegroups.com

You should NOT listen to MouseLeave of the PopUp itself but of all other components around, in addition to the MouseEnter of those components.

 

If all fails, you can put to pop up a close button and forget about MouseLeave and MouseEnters!

Sergey Zhilyakov

unread,
Jan 15, 2014, 2:47:09 PM1/15/14
to exce...@googlegroups.com
but of all other components around, in addition to the MouseEnter of those components.

The close button does work, but the basic idea is to keep the StaysOpen property set to false, so popups  are closed automatically when clicking outside.

Note that I mean interactive popups but not tooltips.


С уважением,
Сергей

Govert van Drimmelen

unread,
Jan 15, 2014, 3:54:10 PM1/15/14
to exce...@googlegroups.com
There were issues using WPF in Office apps in the past.

To really work around this might need to figure out how the windows messages are being routed.

-Govert


С уважением,
Сергей


Sergey

 

To post to this group, send email to exc...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.

To post to this group, send email to exc...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To post to this group, send email to exce...@googlegroups.com.
Visit this group at http://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/groups/opt_out.

Jiri Pik

unread,
Jan 15, 2014, 5:29:04 PM1/15/14
to exce...@googlegroups.com

Sure thing

 

I got the same problem as you have but with Excel 2013. For me the StaysOpen = false didn’t work as I was refreshing the underlying RadGridView on another thread. The solution was to use MouseEnter on all components around the PopUp – in this case, on every single column different from the popup one, and on the TabControl leave and it works wonderfully

 

 

Sergey Zhilyakov

unread,
Jan 16, 2014, 3:20:52 AM1/16/14
to exce...@googlegroups.com
By the way, what does your software do? :) Does it obtain financial statistics from the Internet?

С уважением,
Сергей
image001.png

Jiri Pik

unread,
Jan 16, 2014, 3:58:32 AM1/16/14
to exce...@googlegroups.com

http://SpearianForExcel.com you can check there there the PopUps – get the trial -> Search on Ribbon -> Quandl.

 

I got wonderful support from a number of companies. I will give it back by preparing a number of blog articles which might help the readers of this group.

Reply all
Reply to author
Forward
0 new messages