DataFormCheckBoxField weird behaviour

2 posts, 0 answers
  1. Edward
    Edward avatar
    83 posts
    Member since:
    Feb 2011

    Posted 06 Apr 2011 Link to this post

    1) Is there anyway to make the label appear on the right hand side?

    2) The label does not use all the available space.  The label and the box seems to only occupy half the width.  For example, I have a Grid inside DataTemplate.  The width of a column is 400.  However, if I try to put DataFormCheckBoxField with label "Appointment Contact", the second word "Contact" will actually wrap down despite plenty of space available.  I have to increase the width of the column to 450 to have it working, but then now I have lots of wasted space.

    <telerik:RadDataForm AutoGenerateFields="False">
     <telerik:RadDataForm.ReadOnlyTemplate>
     <DataTemplate>
     <Grid>
     <Grid.ColumnDefinitions>
     <ColumnDefinition Width="*" />
     <ColumnDefinition Width="450" />
    </Grid.ColumnDefinitions>
     <StackPanel Orientation="Vertical" >
     <telerik:DataFormDataField Label="Last Name:" IsEnabled="False" />
     <telerik:DataFormDataField Label="First Name:" IsEnabled="False" />                                       
     <telerik:DataFormDataField Label="Birthdate:" IsEnabled="False" />
     <telerik:DataFormDataField Label="Gender:" IsEnabled="False" />
     </StackPanel>
     <StackPanel Orientation="Vertical" Grid.Column="1">
     <telerik:DataFormCheckBoxField IsEnabled="False" Label="Appointment Contact" FlowDirection="RightToLeft"  HorizontalAlignment="Left" HorizontalContentAlignment="Left" />
     <telerik:DataFormCheckBoxField IsEnabled="False" Label="Do not Call" FlowDirection="RightToLeft"  HorizontalAlignment="Left" />
     </StackPanel>
     </Grid>
     </DataTemplate>
     </telerik:RadDataForm.ReadOnlyTemplate>
                                 
     </telerik:RadDataForm>

  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 08 Apr 2011 Link to this post

    Hi Edward,

    To your questions:

     1. Yes, the label appears on the right hand side when use FlowDirection="RightToLeft".

    2. The text wrapping occurs because in the template of the DataFormDataField, in the inner TextBlock there is an automatic text wrapping. If you want to not waste any space in the column definition you should use Width="Auto" instead of setting a fix width. You can as well edit the DataTemplate of the DataFormCheckBoxField in Blend and change the visual behavior as you would like. 
    Here is the changed xaml:

    <telerik:RadDataForm.ReadOnlyTemplate>
        <DataTemplate>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="auto"/>
                </Grid.ColumnDefinitions>
                <StackPanel Orientation="Vertical" >
                    <telerik:DataFormDataField Label="Last Name:" IsEnabled="False" />
                    <telerik:DataFormDataField Label="First Name:" IsEnabled="False" />
                    <telerik:DataFormDataField Label="Birthdate:" IsEnabled="False" />
                    <telerik:DataFormDataField Label="Gender:" IsEnabled="False" />
                </StackPanel>
                <StackPanel Orientation="Vertical" Grid.Column="1">
                    <Border BorderBrush="Aqua" BorderThickness="1">
                    <telerik:DataFormCheckBoxField IsEnabled="False" Label="Appointment Contact" HorizontalAlignment="Left" HorizontalContentAlignment="Left" FlowDirection="RightToLeft"/>
                    </Border>
                    <telerik:DataFormCheckBoxField IsEnabled="False" Label="Do not Call" HorizontalAlignment="Left"  FlowDirection="RightToLeft" HorizontalContentAlignment="Left" />
                </StackPanel>
            </Grid>
        </DataTemplate>
    </telerik:RadDataForm.ReadOnlyTemplate>

    I have attached a screenshot as well.
     
    Greetings,
    Didie
    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
  3. DevCraft banner
Back to Top