I am trying to bind the commandParamater
of my ContextMenu
item to another element on the form, however no matter what I try the commandParamater
is always null
.
Can someone please show me how to correctly bind the commandParamater
of my context menu item?
What I have:
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Path=Files}">
<Grid>
<Grid.ContextMenu>
<ContextMenu>
<MenuItem Header="Rename Folder"
Command="{Binding Path=ToggleControlVisability}"
CommandTarget="{Binding ElementName=FolderEditor}"
CommandParameter="{Binding ElementName=FolderEditor}">
</MenuItem>
</ContextMenu>
</Grid.ContextMenu>
<Label Content="{Binding Path=FolderName}"></Label>
<StackPanel Name="FolderEditor" Orientation="Horizontal"
Visibility="Hidden">
<TextBox Text="{Binding Path=FolderName}"></TextBox>
</StackPanel>
</Grid>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>