我是 MVVMLight 的新手。我想在全景标签更改后调用一些方法。我想了解有关所选全景选项卡的信息。一个问题是,未调用 HandlePanoramaViewSelected 方法。
我不能让它工作。不知道怎么回事
xml:
<controls:Panorama x:Name="mainViewPanorama">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<cmd:EventToCommand Command ="{Binding PanoramaSelectedViewCommand, Mode=OneWay}"
CommandParameter="{Binding SelectedValue, ElementName=mainViewPanorama}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</controls:Panorama>
构造函数:
PanoramaSelectedViewCommand = new RelayCommand<SelectionChangedEventArgs>(x => HandlePanoramaViewSelected(x));
视图模型:
public RelayCommand<SelectionChangedEventArgs> PanoramaSelectedViewCommand { get; set; }
private void HandlePanoramaViewSelected(SelectionChangedEventArgs args)
{
// do something
}