WPF button, command task, related question

I have a DesignerCanvas (from canvas) that I can add to UIElements and then drag \ drop \ move \ group and move them.

On the toolbar, I have a button attached to a group command.

<Button Margin="0,3,0,3" Padding="5" HorizontalContentAlignment="Left"
        Command="{x:Static s:DesignerCanvas.Group}"
        CommandTarget="{Binding ElementName=DesignerCanvas}">

      

The problem I have is that I can have a control that also contains a DesignerCanvas. So there are nested canvases, and I want the GroupCommand in the toolbox to apply to the canvas that is in focus. In the above binding, it is only bound to the root canvas.

I am assuming I can track the current canvas and expose it to the viewmodel for snapping, but I would rather not track the activecanvas.

Any suggestions for linking ads here?

Thanks, Jeff

+1


a source to share


1 answer


Is GroupCommand RoutedCommand? Assuming this is the case, I expect you to get the desired behavior by removing the assignment of the CommandTarget property.



+2


a source







All Articles