私のContextMenu
アイテムのcommandParamater
をフォーム上の別のエレメントにバインドしようとしていますが、何を試してもは常にnull
です。ContextMenu CommandParamaterバインディング?
私のコンテキストメニューのcommandParamater
を正しくバインドする方法を教えてもらえますか?
私は何を持っている:
<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>
- ここ
は、この問題に対する別の解決策を有するいくつかの記事(離れCodeNakedが提案ものから)であります](http://stackoverflow.com/questions/1013558/elementname-binding-from-menuitem-in-contextmenu) – CodeNaked