WPF ListView Button - Associate multiple images
- by Narayanan
I have a listview in a WPF application that has a button in one of its columns. I associate a image to the button control. I want to configure different images for this button based on the
How do I write the XAML in this scenario???
This is what I have already:
<ControlTemplate x:Key="IconButtonAddProfile" TargetType="{x:Type Button}">
<Grid>
<Image x:Name="myimage" Source="rofile.png" Height="27" Width="65" />
<Border>
<ContentPresenter Content="{TemplateBinding Content}"/>
</Border>
</Grid>
</ControlTemplate>
<ListView.View>
<GridView>
<GridViewColumn Header="Security" Width="50">
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button Template="{StaticResource IconButtonLockSecure}"
DataContext="{Binding}" MinHeight="20" MinWidth="50" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</ListView.View>