Custom Button Column in GridView

2 posts, 0 answers
  1. Kad
    Kad avatar
    9 posts
    Member since:
    Apr 2013

    Posted 17 Apr 2013 Link to this post

    Hi,
    I followed this example to add a button column in my grid using the data template solution
    http://www.telerik.com/help/wpf/gridview-add-button-column.html

    By default all the buttons have Visibility = "Hidden". I want to button to be made visible when user select a row.
    By handling SelectionChanged Event and accessing SelectedItem I do get the selected row. But after that I have no idea how to access the custom column ..i.e. Radbutton in the selected row and change its property. Any ideas?

    Thanks.

  2. Vlad
    Admin
    Vlad avatar
    11042 posts
    Member since:
    Sep 2012

    Posted 18 Apr 2013 Link to this post

    Hi,

     Maybe it will be better in your case to simply bind Visibility property of the Button to GridViewRow IsSelected. For example:
    ...
    <Grid.Resources>
                <telerik:BooleanToVisibilityConverter x:Key="converter" />
            </Grid.Resources>
    ...

    <Button Content="Button" Visibility="{Binding IsSelected, RelativeSource={RelativeSource AncestorType=telerik:GridViewRow}, Converter={StaticResource converter}}" />
    ....

    Greetings,
    Vlad
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top