WPF ListView Button - Associate multiple images

Posted by Narayanan on Stack Overflow See other posts from Stack Overflow or by Narayanan
Published on 2010-06-15T16:12:15Z Indexed on 2010/06/16 0:02 UTC
Read the original article Hit count: 241

Filed under:
|

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>

© Stack Overflow or respective owner

Related posts about wpf

Related posts about listview