Witam
Kod xaml:
<ListBox x:Name="LayerVisibilityList" Grid.Row="2" SelectionMode="Multiple" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
SelectionChanged="LayerVisibilityList_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Width="480">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="80"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Content="<" FontSize="14" Click="LayerDown"/>
<Grid Grid.Column="1">
<TextBlock Text="{Binding LayerID}" FontSize="35" HorizontalAlignment="Center"/>
</Grid>
<Button Grid.Column="2" Content=">" FontSize="14" Click="LayerUp"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
Problem polega na tym, że chciałbym po kliknięciu na button w konkretnym itemie uzyskać referencję do tego itema. Próbowałem:
object obj = ((Grid)((Button)sender).Parent).Parent
ale zwraca null'a.
Pzdr