Enabling/Disabling Buttons Contained in DataGrid

2 posts, 0 answers
  1. Freddy
    Freddy avatar
    4 posts
    Member since:
    Jan 2015

    Posted 20 May Link to this post

    I've got a question about enabling/disabling buttons that are contained with a RadDataGrid. So one of the columns in my grid contains several buttons. Here is some of the XAML:

           

    <telerikGrid:DataGridTemplateColumn  Header="Actions" SizeMode="Fixed" Width="265" CanUserEdit="False">
                        <telerikGrid:DataGridTemplateColumn.CellContentTemplate>
                            <DataTemplate>
                                <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
                                    <Button MinWidth="70" Content="GoTo" Name="blah" Click="goTime_Clicked" BorderBrush="White" FontSize="18" />
                                    <Button MinWidth="70" Content="Update" Click="setTime_Clicked" BorderBrush="White" FontSize="18"/>
                                    <Button MinWidth="70" Content="Delete" Click="delCue_Clicked" BorderBrush="White" FontSize="18"/>
                                </StackPanel>
                            </DataTemplate>
                        </telerikGrid:DataGridTemplateColumn.CellContentTemplate>
                    </telerikGrid:DataGridTemplateColumn>


    In certain situations I need to be able to enable/disable the "Goto" button for each item in the grid. How can I access the "Goto" button in my C# code?

    Thanks!

     

  2. Freddy
    Freddy avatar
    4 posts
    Member since:
    Jan 2015

    Posted 24 May Link to this post

    Nevermind, I figured it out. It was a easy fix, but not immediately obvious to me since my XAML skills aren't that great.

    I just needed to bind a property to IsEnabled like follows:

    <Button MinWidth="70" Content="GoTo" Click="goTime_Clicked" BorderBrush="White" FontSize="18" IsEnabled="{Binding  Path=customPropertyNameHere}" />

Back to Top