【发布时间】:2013-02-08 13:42:21
【问题描述】:
这是我的xaml
<ListBox x:Name="HistoryList"
ItemsSource="{Binding HistoryCollection}"
>
<ListBox.ItemTemplate >
</DataTemplate>
<CheckBox x:Name="UpCheckBox" Height="50" Width="50" >
<interactivity:Interaction.Triggers>
<interactivity:EventTrigger EventName="Checked">
<interactivity:InvokeCommandAction Command="{Binding UpCheckedCommad}" CommandParameter="{Binding ElementName=UpCheckBox}"></interactivity:InvokeCommandAction>
</interactivity:EventTrigger>
</interactivity:Interaction.Triggers>
</CheckBox>
</DataTemplate>
</ListBox.ItemTemplate >
</ListBox >
在ViewModel我用过GalasoftMVVM Command Binding
public ICommand UpCheckedCommad
{
get { return new RelayCommand<Object>(x => { PerformUpforTracks(x); }); }
}
void PerformUpforTracks(object x)
{
//TODO
}
我在ListBox ItemTemplate 中使用了CheckBox。但在ViewModel 中没有得到CheckBox 的Checked 事件。
我想从我的 ViewModel 中获取 Checked Event。
任何人都可以解决这个问题吗?
【问题讨论】:
标签: c# silverlight windows-phone-7 xaml windows-phone-8