In Windows 8, C# + xaml
i have some class
Class ABC
{
public string a {get; set;}
public void someMethod()
{
**some code, changing a**
}
}
and binding in xaml
<ListBox x:Name="playlistBox">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding a}"/>
<Button Name="removeAlbumBtn" Content="method" Click="**NEED BINDING TO SOMEMETHOD HERE**"/>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
So what i must type to call someMethod???
You need to handle the
Clickevent through a handler method in the code behind of that xaml file. For example, if the xaml you show is in aMyControl.xaml. You’ll have a method like the following in theMyControl.xaml.cs:And change the xaml to be: