DataFormCheckBoxField IsEnabled

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

    Posted 05 Jun 2013 Link to this post

    Hi,

    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?
    thanks
    Regards
    rene

     

  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 07 Jun 2013 Link to this post

    Hello,

     You can bind them like this:

    <Window.Resources>
            <my:MyViewModel x:Key="MyViewModel"/>
            <DataTemplate x:Key="dt">
                <StackPanel>
                    <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}"/>
                </StackPanel>
            </DataTemplate>
        </Window.Resources>
        <Grid DataContext="{StaticResource MyViewModel}" >
            <telerik:RadDataForm ItemsSource="{Binding Clubs}" EditTemplate="{StaticResource dt}" ReadOnlyTemplate="{StaticResource dt}" AutoGenerateFields="False">
            </telerik:RadDataForm>
        </Grid>

    Regards,
    Ivan Ivanov
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

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