[代码片段]WPF中,使用MVVM对MenuItem进行绑定时传递相关参数
1 <MenuItem Header="Softs" ItemsSource="{Binding Source={StaticResource Proxy}, Path=Data.Softs}" > 2 <MenuItem.ItemContainerStyle> 3 <Style TargetType="MenuItem"> 4 <Setter Property="MenuItem.Header" Value="{Binding SoftName}"/> 5 <Setter Property="MenuItem.Command" Value="{Binding Source={StaticResource Proxy}, Path=Data.SoftRunCommand}"/> 6 <Setter Property="MenuItem.CommandParameter" Value="{Binding}"/> 7 </Style> 8 </MenuItem.ItemContainerStyle> 9 </MenuItem>
记录一下如何对MenuItem进行MVVM绑定