DataFormCheckBoxField IsEnabled

2 posts, 0 answers
  1. ITA
    ITA avatar
    383 posts
    Member since:
    Aug 2009

    Posted 05 Jun 2013 Link to this post


    i use a DataForm with lots of DataFormCheckBoxFields. Now i want to Enable or Disable some of these fields if
    one of theme is checked?

    If this is checked:
    <telerik:DataFormCheckBoxField Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5" Label="FIRMA:" Foreground="Black" HorizontalAlignment="Left" x:Name="FirmaConf"                                                                           VerticalContentAlignment="Center" VerticalAlignment="Center" DataMemberBinding="{Binding Firma,Mode=TwoWay}"  />

    this should be enabled
             <telerik:DataFormCheckBoxField Grid.Row="1" Grid.Column="0" Label="zeigen:" Foreground="Black" HorizontalAlignment="Left" x:Name="FirmazeigenConf"                                                                            VerticalContentAlignment="Center" VerticalAlignment="Center" DataMemberBinding="{Binding FIRzeigen,Mode=TwoWay}"
    IsEnabled="{Binding ElementName=FirmaConf, Path=DataMemberBinding, Mode=TwoWay}"/>

    But how will i do this?


  2. Ivan Ivanov
    Ivan Ivanov avatar
    1128 posts

    Posted 07 Jun 2013 Link to this post


     You can bind them like this:

            <my:MyViewModel x:Key="MyViewModel"/>
            <DataTemplate x:Key="dt">
                    <telerik:DataFormDataField DataMemberBinding="{Binding Name, Mode=TwoWay}" />
                    <telerik:DataFormCheckBoxField x:Name="chbx" />
                    <telerik:DataFormDateField DataMemberBinding="{Binding Established, Mode=TwoWay}" IsEnabled="{Binding ElementName=chbx, Path=Content.IsChecked}"/>
                    <telerik:DataFormDataField DataMemberBinding="{Binding StadiumCapacity, Mode=TwoWay}" IsEnabled="{Binding ElementName=chbx, Path=Content.IsChecked}"/>
        <Grid DataContext="{StaticResource MyViewModel}" >
            <telerik:RadDataForm ItemsSource="{Binding Clubs}" EditTemplate="{StaticResource dt}" ReadOnlyTemplate="{StaticResource dt}" AutoGenerateFields="False">

    Ivan Ivanov

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top