Hi,
I'm using MVVM pattern on Diagram. I have a context menu set inside a style for targettype RadDiagramContainerShape. I want to pass the mouse position to the command as parameter (inside "NewShapeMenuItem" MenuItem).
How can I achieve this?
<Style TargetType="telerik:RadDiagramContainerShape">
<Setter Property="ContextMenu">
<Setter.Value>
<ContextMenu Name="ComponentContextMenu">
<MenuItem Name="NewMenuItem" Header="New">
<MenuItem Name="NewShapeMenuItem" Header="Shape" Command="{Binding AddCommand}" CommandParameter="{Binding ElementName=StateDiagram, Path=ActualHeight}" Icon="{StaticResource GoToShapeImage}"/>
</MenuItem>
<Separator/>
<MenuItem Header="Go to State" ItemsSource="{Binding ParentFacility.SelectedComponentViewModel.StateViewModels}"><!--IsEnabled="{Binding ParentFacility.Parent.IsOnline, Mode=TwoWay}"-->
<MenuItem.IsEnabled>
<MultiBinding Converter="{StaticResource ComponentToIsEnabledConverter}" Mode="TwoWay">
<Binding Path="ParentFacility.Parent.IsOnline" Mode="TwoWay"/>
<Binding Path="ParentFacility.SelectedComponentViewModel"/>
</MultiBinding>
</MenuItem.IsEnabled>
<MenuItem.ItemContainerStyle>
<Style TargetType="MenuItem">
<Setter Property="Icon" Value="{StaticResource GoToStateImage}"></Setter>
<Setter Property="Header" Value="{Binding Name}"></Setter>
<Setter Property="Command" Value="{Binding ParentComponent.ParentFacility.GoToStateCommand}"></Setter>
<Setter Property="CommandParameter" Value="{Binding}"></Setter>
</Style>
</MenuItem.ItemContainerStyle>
</MenuItem>
</ContextMenu>
</Setter.Value>
</Setter>
</Style>
I'm using MVVM pattern on Diagram. I have a context menu set inside a style for targettype RadDiagramContainerShape. I want to pass the mouse position to the command as parameter (inside "NewShapeMenuItem" MenuItem).
How can I achieve this?
<Style TargetType="telerik:RadDiagramContainerShape">
<Setter Property="ContextMenu">
<Setter.Value>
<ContextMenu Name="ComponentContextMenu">
<MenuItem Name="NewMenuItem" Header="New">
<MenuItem Name="NewShapeMenuItem" Header="Shape" Command="{Binding AddCommand}" CommandParameter="{Binding ElementName=StateDiagram, Path=ActualHeight}" Icon="{StaticResource GoToShapeImage}"/>
</MenuItem>
<Separator/>
<MenuItem Header="Go to State" ItemsSource="{Binding ParentFacility.SelectedComponentViewModel.StateViewModels}"><!--IsEnabled="{Binding ParentFacility.Parent.IsOnline, Mode=TwoWay}"-->
<MenuItem.IsEnabled>
<MultiBinding Converter="{StaticResource ComponentToIsEnabledConverter}" Mode="TwoWay">
<Binding Path="ParentFacility.Parent.IsOnline" Mode="TwoWay"/>
<Binding Path="ParentFacility.SelectedComponentViewModel"/>
</MultiBinding>
</MenuItem.IsEnabled>
<MenuItem.ItemContainerStyle>
<Style TargetType="MenuItem">
<Setter Property="Icon" Value="{StaticResource GoToStateImage}"></Setter>
<Setter Property="Header" Value="{Binding Name}"></Setter>
<Setter Property="Command" Value="{Binding ParentComponent.ParentFacility.GoToStateCommand}"></Setter>
<Setter Property="CommandParameter" Value="{Binding}"></Setter>
</Style>
</MenuItem.ItemContainerStyle>
</MenuItem>
</ContextMenu>
</Setter.Value>
</Setter>
</Style>