This is a migrated thread and some comments may be shown as answers.

Enabling/Disabling Buttons Contained in DataGrid

1 Answer 161 Views
DataGrid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Freddy
Top achievements
Rank 1
Freddy asked on 20 May 2016, 09:44 PM

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!

 

1 Answer, 1 is accepted

Sort by
0
Freddy
Top achievements
Rank 1
answered on 24 May 2016, 10:31 PM

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}" />

Tags
DataGrid
Asked by
Freddy
Top achievements
Rank 1
Answers by
Freddy
Top achievements
Rank 1
Share this question
or