6
Windows Phone 8の親要素のdatacontextにはどのようにアクセスできますか? AncestorTypeはWP8では使用できません。WP8 - 親のデータアクセステキスト
<ItemsControl x:Name="Elements" ItemsSource="{Binding MyList}" Grid.Row="2" Grid.Column="3">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<toolkit:WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Content="e" Width="100" Height="100" Command="{Binding MyCommand" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
"MyCommand"は "MyList"の外で定義されています。では、私のボタンからルートのdatacontext(DataContext = MyClass)にアクセスするにはどうしたらいいですか? MyCommandは、MyClassクラスで定義されています。
ありがとうございます。
ありがとう – user1288039