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

DataFormField vary in size

2 Answers 87 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Alan
Top achievements
Rank 1
Alan asked on 14 Jan 2015, 09:06 AM
Hi,

I have a RadDataForm using Windows8Theme (although the theme doesn't seem to matter) with the following definition:

<telerik:RadDataForm x:Name="radUserForm" Grid.Row="0" AutoGenerateFields="False" ItemsSource="{Binding Path=UsersList}">
            <telerik:RadDataForm.ReadOnlyTemplate>
                <DataTemplate>
                    <StackPanel>
                        <telerik:DataFormDataField DataMemberBinding="{Binding AD_Username, Mode=OneWay}" Label="AD Username" IsEnabled="False" >
                            <telerik:DataFormDataField.Content>
                                <telerik:RadComboBox ItemsSource="{Binding Source={StaticResource ResourceKey=SysUsersList}}"
                                                     DisplayMemberPath="USER_NAME" SelectedValuePath="USER_ID" SelectedValue="{Binding AD_Username}"
                                                     IsEnabled="False"/>
                            </telerik:DataFormDataField.Content>
                        </telerik:DataFormDataField>
 
                        <telerik:DataFormDataField DataMemberBinding="{Binding Username, Mode=OneWay}" Label="Username" IsEnabled="False" />
                        <telerik:DataFormDataField DataMemberBinding="{Binding Email, Mode=OneWay}" Label="E-Mail" IsEnabled="False" />
                        <telerik:DataFormDataField DataMemberBinding="{Binding ProfileId, Mode=OneWay}" Label="Profile" IsEnabled="False">
                            <telerik:DataFormDataField.Content>
                                <telerik:RadComboBox ItemsSource="{Binding Source={StaticResource ResourceKey=ProfilesList}}" 
                                                     DisplayMemberPath="ProfileName" SelectedValuePath="Id"
                                                     SelectedValue="{Binding ProfileId}" IsEnabled="False" />
                            </telerik:DataFormDataField.Content>
                        </telerik:DataFormDataField>
                    </StackPanel>
                </DataTemplate>
            </telerik:RadDataForm.ReadOnlyTemplate>
            <telerik:RadDataForm.EditTemplate>
                <DataTemplate>
                    <StackPanel>
                        <telerik:DataFormDataField DataMemberBinding="{Binding AD_Username, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Label="AD Username" IsEnabled="True" >
                            <telerik:DataFormDataField.Content>
                                <telerik:RadComboBox ItemsSource="{Binding Source={StaticResource ResourceKey=SysUsersList}}"
                                                     DisplayMemberPath="USER_NAME" SelectedValuePath="USER_ID" SelectedValue="{Binding AD_Username}"
                                                     IsEnabled="True"/>
                            </telerik:DataFormDataField.Content>
                        </telerik:DataFormDataField>
 
                        <telerik:DataFormDataField  Label="Username" IsEnabled="True"
                                                    DataMemberBinding="{Binding Username, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" />
                        <telerik:DataFormDataField  Label="E-Mail" IsEnabled="True"
                                                    DataMemberBinding="{Binding Email, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged,  ValidatesOnNotifyDataErrors=True}" />
                        <telerik:DataFormDataField DataMemberBinding="{Binding ProfileId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged,
                            ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True}" Label="Profile" IsEnabled="True" >
                            <telerik:DataFormDataField.Content>
                                <telerik:RadComboBox ItemsSource="{Binding Source={StaticResource ResourceKey=ProfilesList}}"
                                                     DisplayMemberPath="ProfileName" SelectedValuePath="Id"
                                                     SelectedValue="{Binding ProfileId}" IsEnabled="True" />
                            </telerik:DataFormDataField.Content>
                        </telerik:DataFormDataField>
                        <telerik:DataFormDataField  Label="Password">
                            <PasswordBox MaxLength="50" controls:PasswordBoxAssistant.BindPassword="True"
                                         controls:PasswordBoxAssistant.BoundPassword="{Binding Path=PasswordString, Mode=TwoWay,
                                        UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" />
                        </telerik:DataFormDataField>
                    </StackPanel>
                </DataTemplate>
            </telerik:RadDataForm.EditTemplate>
            <telerik:RadDataForm.NewItemTemplate>
                <DataTemplate>
                    <StackPanel>
                        <telerik:DataFormDataField DataMemberBinding="{Binding AD_Username, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Label="AD Username" IsEnabled="True" >
                            <telerik:DataFormDataField.Content>
                                <telerik:RadComboBox ItemsSource="{Binding Source={StaticResource ResourceKey=SysUsersList}}"
                                                     DisplayMemberPath="USER_NAME" SelectedValuePath="USER_ID" SelectedValue="{Binding AD_Username}"
                                                     IsEnabled="True"/>
                            </telerik:DataFormDataField.Content>
                        </telerik:DataFormDataField>
 
                        <telerik:DataFormDataField  Label="Username" IsEnabled="True"
                                                    DataMemberBinding="{Binding Username, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" />
                        <telerik:DataFormDataField  Label="E-Mail" IsEnabled="True"
                                                    DataMemberBinding="{Binding Email, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged,  ValidatesOnNotifyDataErrors=True}" />
                        <telerik:DataFormDataField  Label="Password">
                            <PasswordBox MaxLength="50" controls:PasswordBoxAssistant.BindPassword="True"
                                         controls:PasswordBoxAssistant.BoundPassword="{Binding Path=PasswordString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged,
                                 ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True}" />
                        </telerik:DataFormDataField>
 
                        <telerik:DataFormDataField DataMemberBinding="{Binding ProfileId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged,
                            ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True}"
                                                   Label="Profile" IsEnabled="True" >
                            <telerik:DataFormDataField.Content>
                                <telerik:RadComboBox ItemsSource="{Binding Source={StaticResource ResourceKey=ProfilesList}}"
                                                     DisplayMemberPath="ProfileName" SelectedValuePath="Id"
                                                     SelectedValue="{Binding ProfileId}" IsEnabled="True" />
                            </telerik:DataFormDataField.Content>
                        </telerik:DataFormDataField>
                    </StackPanel>
                </DataTemplate>
            </telerik:RadDataForm.NewItemTemplate>
        </telerik:RadDataForm>


The result is the attached image. Notice how username and e-mail fields are of a different size than the other field.

Could you kindly shed some light to this?

Regards,
Daryl

2 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 16 Jan 2015, 09:04 AM
Hi Daryl,


Thank you for contacting us. As it turns out, once you manually define the fields something went wrong with the alignment of the fields. This results to incorrect height of different types of fields in RadDataForm.
The behavior could be considered as abnormal, because this could not be reproduced in our demos with manually defined data fields. 

Do you have defined any styles targeted at TextBox element? 

I believe that the best option here would be to prepare runnable project, that we could test by our side. 
You may send it back to us as an attachment in a new support thread. 

I look forward to hearing from you. 

Regards,
Vanya Pavlova
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Alan
Top achievements
Rank 1
answered on 16 Jan 2015, 09:19 AM
Hi Vanya,

Thank you very much for your help.

Turns out I had a window resource targeting all TextBoxes outside of the user control that defined the RadDataForm - right in front of my face :). 

Regards,
Daryl
Tags
DataForm
Asked by
Alan
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Alan
Top achievements
Rank 1
Share this question
or