Hello. I have a xamdockmanager with several SplitPanes and one ContentPane per SplitPane. I need to fire an event when a user clicks on the header of the ContentPane. This is how I'm assuming you would do this:
<igWPF:XamDockManager LayoutMode="FillContainer" Background="LightBlue" >
<igWPF:XamDockManager.Panes>
<igWPF:SplitPane Name="HendaySplitPane">
<i:Interaction.Triggers> <i:EventTrigger EventName="MouseEnter" > <mvvmlight:EventToCommand Command="{Binding OnHendayPaneFocusCommand}" PassEventArgsToCommand="True" /> </i:EventTrigger> </i:Interaction.Triggers>
content pane stuff
</igWPF:ContentPane> </igWPF:SplitPane>
</igWPF:XamDockManager.Panes> </igWPF:XamDockManager>
For EventName I've tried GotFocus, MouseLeftButtonUp along with several others but the event never fires. How can I set this up? Also ideally I would like to put Interaction.Triggers at the xamdockmanager level and have it pass the name of the content pane that got the focus. Thanks
Hi Kris,
I've tried using that trigger on my own SplitPanes and the event is firing as I'd expect. I have attached a sample just to demonstrate this.
What is your exact requirement though? Do you require notification when the user clicks on a ContentPane or do you just need to know if the pane has just been focused? The difference between these are that clicking on the pane will constantly fire the event even though it's already focused versus only firing the one time of initial focus. If you just require one notification of initial focus then the XamDockManager's ActivePaneChanged event is much more appropriate for this.
Thanks for the reply and for the sample project. I need to know when a pane has focus so I can updated some data. Yes, the ActivePaneChanged event is what I was looking for.
I'm glad that helped. Let me know if you have any further questions regarding this matter.
There is another issue. Please have a look at the attached project. The ActivePaneChanged event actually fires like 20 times on a single pane focus. Your help is really apreciated.
Hello Kris,
I only see the event firing once on a single pane focus. Are you using a breakpoint inside of your command in order to determine this? One thing you have to keep in mind is that ActivePaneChanged is going to fire every time the XamDockManager.ActivePane property is changed. This property changes not only when you click on different ContentPanes, but it also changes when the XamDockManager loses focus, or the entire window itself loses focus. When the dock manager or the window loses focus, the ActivePane is set to null.
So if you are using breakpoints inside the command, when the event fires it causes Visual Studio to gain focus which sets the ActivePane to null, then if you try to continue the breakpoint is hit again because of the null. This creates a situation where the ActivePane is constantly being set between null and a ContentPane which causes the event to constantly fire. Place a Console.WriteLine() inside your command and remove the breakpoint and you'll see it only fires once.
You're welcome. Let me know if you have any further questions regarding this matter.
I was using breakpoints to determine this, yes. You are right, i can see the console.writeline() statement only executing once. Thanks for the explanation. I appreciate it.