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

DataFormCheckBoxField IsEnabled

1 Answer 47 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
ITA
Top achievements
Rank 1
ITA asked on 05 Jun 2013, 10:51 AM
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

 

1 Answer, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 07 Jun 2013, 12:49 PM
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.

Tags
DataForm
Asked by
ITA
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Share this question
or