3 Answers, 1 is accepted
0
Harald
Top achievements
Rank 2
answered on 04 Jul 2016, 10:58 AM
When i set AutoGenerateFields="True" and using no DataTemplate it works. After i set AutoGenerateFields="False" and using the Templates it does not work.
01.
<
DataTemplate
x:Key
=
"WriteTemplate"
>
02.
<
Grid
>
03.
<
Grid.ColumnDefinitions
>
04.
<
ColumnDefinition
Width
=
"150"
></
ColumnDefinition
>
05.
<
ColumnDefinition
Width
=
"*"
></
ColumnDefinition
>
06.
</
Grid.ColumnDefinitions
>
07.
<
Grid.RowDefinitions
>
08.
<
RowDefinition
Height
=
"35"
></
RowDefinition
>
09.
<
RowDefinition
Height
=
"35"
></
RowDefinition
>
10.
<
RowDefinition
Height
=
"35"
></
RowDefinition
>
11.
<
RowDefinition
Height
=
"35"
></
RowDefinition
>
12.
<
RowDefinition
Height
=
"35"
></
RowDefinition
>
13.
</
Grid.RowDefinitions
>
14.
<
Label
Grid.Row
=
"0"
Grid.Column
=
"0"
Margin
=
"0,5,0,0"
>Katalogeintrag:</
Label
>
15.
<
Label
Grid.Row
=
"1"
Grid.Column
=
"0"
Margin
=
"0,5,0,0"
>Katalogwert:</
Label
>
16.
<
Label
Grid.Row
=
"2"
Grid.Column
=
"0"
Margin
=
"0,5,0,0"
>Gültig ab:</
Label
>
17.
<
Label
Grid.Row
=
"3"
Grid.Column
=
"0"
Margin
=
"0,5,0,0"
>Gültig bis:</
Label
>
18.
<
Label
Grid.Row
=
"4"
Grid.Column
=
"0"
Margin
=
"0,5,0,0"
>Gesperrt:</
Label
>
19.
<
telerik:DataFormDataField
Grid.Row
=
"0"
Grid.Column
=
"1"
DataMemberBinding
=
"{Binding Name , Mode=TwoWay}"
HorizontalAlignment
=
"Stretch"
LabelPosition
=
"Above"
Mode
=
"Edit"
Margin
=
"0,-22,0,0"
/>
20.
<
telerik:DataFormDataField
Grid.Row
=
"1"
Grid.Column
=
"1"
DataMemberBinding
=
"{Binding Value , Mode=TwoWay}"
HorizontalAlignment
=
"Stretch"
LabelPosition
=
"Above"
Margin
=
"0,-22,0,0"
/>
21.
<
telerik:DataFormDateField
Grid.Row
=
"2"
Grid.Column
=
"1"
DataMemberBinding
=
"{Binding Start , Mode=TwoWay}"
HorizontalAlignment
=
"Stretch"
LabelPosition
=
"Above"
Margin
=
"0,-22,0,0"
/>
22.
<
telerik:DataFormDateField
Grid.Row
=
"3"
Grid.Column
=
"1"
DataMemberBinding
=
"{Binding End , Mode=TwoWay}"
HorizontalAlignment
=
"Stretch"
LabelPosition
=
"Above"
Margin
=
"0,-22,0,0"
/>
23.
<
telerik:DataFormCheckBoxField
Grid.Row
=
"4"
Grid.Column
=
"1"
DataMemberBinding
=
"{Binding Locked , Mode=TwoWay}"
HorizontalAlignment
=
"Stretch"
LabelPosition
=
"Above"
Margin
=
"0,-22,0,0"
/>
24.
</
Grid
>
25.
</
DataTemplate
>
0
Accepted
Hello Harald,
The behavior you're experiencing is due to the fact that the negative margins that have been set for the RadDataForm fields contradict with the fixed heights you have set for your RowDefinitions' heights.
Here's an example of how to define your DataTemplate, so that it can correctly focus the fields:
If you would, however, like to go with the approach you have so far, you will need to either remove the negative margins or increase the RowDefinitions' heights so that they can fit the RadDataForm fields.
I hope this solves your issue. Do let me know how this goes.
Regards,
Dilyan Traykov
Telerik by Progress
The behavior you're experiencing is due to the fact that the negative margins that have been set for the RadDataForm fields contradict with the fixed heights you have set for your RowDefinitions' heights.
Here's an example of how to define your DataTemplate, so that it can correctly focus the fields:
<
DataTemplate
x:Key
=
"WriteTemplate"
>
<
StackPanel
Orientation
=
"Vertical"
>
<
telerik:DataFormDataField
Label
=
"Name"
DataMemberBinding
=
"{Binding Name , Mode=TwoWay}"
/>
<
telerik:DataFormDataField
Label
=
"Number"
DataMemberBinding
=
"{Binding Number , Mode=TwoWay}"
/>
<
telerik:DataFormDateField
Label
=
"Position"
DataMemberBinding
=
"{Binding Position , Mode=TwoWay}"
/>
<
telerik:DataFormDateField
Label
=
"Country"
DataMemberBinding
=
"{Binding Country , Mode=TwoWay}"
/>
</
StackPanel
>
</
DataTemplate
>
If you would, however, like to go with the approach you have so far, you will need to either remove the negative margins or increase the RowDefinitions' heights so that they can fit the RadDataForm fields.
I hope this solves your issue. Do let me know how this goes.
Regards,
Dilyan Traykov
Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Harald
Top achievements
Rank 2
answered on 06 Jul 2016, 07:00 PM
Thank you.