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

WPF: Disabling a row in a GridView based off of a value in the source

2 Answers 623 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Petar
Top achievements
Rank 1
Petar asked on 12 May 2011, 10:13 PM
Hi,

I found this blog post http://www.buildsucceeded.com/post/2009/07/17/WPF-Disabling-a-row-in-a-Grid-based-off-of-a-value-in-the-source.aspx that talks about using style triggers to turn the grid row on/off using binding. I cannot make this to work with my HierarchyChildTemplate control.

<telerik:RadGridView x:Name="DetailsView"
CanUserFreezeColumns="False" CanUserDeleteRows="True" CanUserInsertRows = "True"
SelectionMode="Single" SelectionUnit="FullRow"
AutoGenerateColumns="False" 
ShowInsertRow="True"
ItemsSource="{Binding ReceiptEditRows, Mode=OneWay}" 
SelectedItem="{Binding DataContext.SelectedRowViewModel, Mode=TwoWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}}"
ShowGroupPanel="False"
IsReadOnly="False"  IsFilteringAllowed="False">
   <telerik:RadGridView.Resources>
      <Style TargetType="{x:Type telerik:GridViewRow}">
         <Setter Property="IsEnabled" Value="True" />
         <Style.Triggers>
            <DataTrigger Binding="{Binding Path=CanEditChildRow}" Value="True">
               <DataTrigger.Setters>
                  <Setter Property="IsEnabled" Value="True" />
               </DataTrigger.Setters>
            </DataTrigger>
         </Style.Triggers>
      </Style>
   </telerik:RadGridView.Resources>
   <telerik:RadGridView.Columns>

Is this supposed to work?

Petar.

2 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 13 May 2011, 07:46 AM
Hello Petar,

You may try to use a RowStyleSelector instead. Please take a look at our online documentation and demos for further reference.

Regards,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Petar
Top achievements
Rank 1
answered on 14 May 2011, 01:14 AM
Tank you for your response. There is a very little about RowStyleSelector used purely in XAML with MVVM. Do you have a sample that shows off the use with MVVM and XAML driven style selections (via binding)?

Thanks.
Tags
GridView
Asked by
Petar
Top achievements
Rank 1
Answers by
Maya
Telerik team
Petar
Top achievements
Rank 1
Share this question
or