I want to make additinal block of buttons to control Xceed.Wpf.Toolkit.Zoombox.Zoombox
.
In current implementation Zoombox commands are RoutedUICommands
so if I use them Zoombox
control don't recive them.
Here is a sample XAML:
<xctk:Zoombox>
<Image Source="{Binding ImageAttachment.Path}" infrastructure:AttachedProperties.IgnoreVerticalAligment="True" />
</xctk:Zoombox>
<StackPanel>
<Button x:Name="HomeButton"
Width="20px"
Height="20px"
Command="xctk:Zoombox.Home"
Style="{StaticResource TransparentButton}"
ToolTip="Go Home">
<Image Margin="2" Source="{StaticResource HomeGlyph}" />
</Button>
<Button x:Name="FitButton"
Width="20px"
Height="20px"
Margin="2,0"
Command="xctk:Zoombox.Fit"
Style="{StaticResource TransparentButton}"
ToolTip="Fit Content within Bounds">
<Image Margin="2" Source="{StaticResource FitContentGlyph}" />
</Button>
<StackPanel>
Is there any way include a control to route of RoutedUICommands?
A RoutedCommand works by starting at the control that generated the command and bubbling up through the hierarchy of controls until it is handled. In your case here, the RoutedCommand's path would go: Button > StackPanel > Window. The RoutedCommand wouldn't go to the Zoombox because it is a sibling of the StackPanel and not a parent.
In order to make it work, you need to use the CommandTarget property of the button. The CommandTarget causes the RoutedCommand to start from the target then work its way up the tree. You can do that like this:
<xctk:Zoombox x:Name="myZoomBox">
<Image Source="{Binding ImageAttachment.Path}"/>
</xctk:Zoombox>
<StackPanel>
<Button x:Name="HomeButton"
Command="xctk:Zoombox.Home"
CommandTarget="{Binding ElementName=myZoomBox}"/>
</StackPanel>