次のリストボックスを備えたWindowsPhone7アプリケーションがあり、すべてのアイテムに2つのテキストブロックと1つのHyperlinkButtonが含まれています。
<ListBox.ItemTemplate><DataTemplate><StackPanel Orientation="Vertical">
<TextBlock/>
<TextBlock/>
<HyperlinkButton Content="[More...]" FontSize="12"HorizontalAlignment="Right" Height="30" Click="ClickEvent">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click"<GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding GetCommand, Mode=OneWay}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</HyperlinkButton>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
ViewModelコンストラクターには、次のコードがあります。
GetCommand = new RelayCommand(() =>{some code}); where GetCommand is a property :
public RelayCommand GetCommand { get; private set; }
私の問題はGetCommand = new RelayCommand(() =>{some code});
、ボタンを押しても実行されないことです。
HyperlinkButtonがitemTemplateを挿入しない場合、すべてが正常に機能することを言わなければなりません。私はGalasoftmvvmlighttakeitを使用しています-http ://www.galasoft.ch/mvvm/getstarted/助けていただければ幸い です。