I am trying to add an Interaction Trigger to a ButtonTool, but it is not working. I don't get any errors on the Output window when I run my solution, but it doesn't do anything either.
1.- I have a Ribbon Window with a Ribbon and a Dock Manager
2.- I’m trying to use the Interaction triggers on a Button Tool to collapse a Split Pane
<igWpf:ButtonTool Caption="Framework"
x:Name="FrameworkButton"
LargeImage="{DynamicResource Image_PlaceHolder32}"
Style="{DynamicResource StandardHighPriority}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="PreviewMouseLeftButtonDown">
<ei:GoToStateAction StateName="FrameworkCollapsed"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</igWpf:ButtonTool>
3. - The Interaction Trigger is calling a Visual State that is presented at the Ribbon Level and the Visual State is targeting the Split Pane (RightPaneProperties) in the Dock Manager
<!-- Visual States -->
<VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="VisualStateGroup"> <VisualState x:Name="FrameworkCollapsed"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="RightPaneProperties"> <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}"/> </ObjectAnimationUsingKeyFrames> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups>
<!--DockManager-->
<igDock:XamDockManager> <igDock:XamDockManager.Panes> <igDock:SplitPane igDock:XamDockManager.InitialLocation="DockedRight" Width="300" x:Name="RightPaneProperties"> <igDock:ContentPane x:Name="bottomEdgeDock1" Header="Framework"> <local:Framework/> </igDock:ContentPane> </igDock:SplitPane> </igDock:XamDockManager.Panes>
Attached you can find the full xaml. Why is the interaction Trigger not working?
Thank you!
Hello Dzyann,
I have taken a look at your xaml file and created a sample project for you. In order to make it work i had to do the following changes:
- Moved the VisualStateManager.VisualStateGroup inside the split pane (RightPaneProperties)
- Since i don't have your custom behaviour i hooked up to the PreviewMouseLeftButtonDown event and called VisualStateManager.GoToElementState(...)
If you still have issues, please send me a sample project with your custom behavior.
Martin,
Thanks for your solution, it works for us. I'm working with Dzyann on this issue and I have it implemented it in our solution, but I keep getting an error saying that "dock" does not exist in the current context. This is from the CS code you provided here.
private void FrameworkButton_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
VisualStateManager.GoToElementState((SplitPane)dock.Panes[0], "FrameworkCollapsed", false);
}