1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| <Grid>
<ListView Name="LVuser" Grid.Row="0" Grid.ColumnSpan="5" Margin="10,10,10,0" ItemsSource="{Binding Users}" SelectedItem="{Binding SelectedUser}">
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="TextBlockTitle" Text="{Binding Title}" VerticalAlignment="Center" Grid.Column="3" FontWeight="Bold" />
<Button Name="Button1" Content="Enable" Width="100" Margin="5,5,5,5" Command="{Binding DataContext.testCommand ,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ItemsControl}}}" />
<Button Name="Button2" Content="Disable" Width="100" Margin="5,5,5,5" Command="{Binding DataContext.testCommand ,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ItemsControl}}}" />
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid> |
Partager