8 Answers, 1 is accepted
Yes, it is possible. You need to predefine the template of the DataFormDataField as per your requirement.
Then in the AutoGeneratingField event handler, set the predefined control template:
private
void
DataForm_AutoGeneratingField(
object
sender, Telerik.Windows.Controls.Data.DataForm.AutoGeneratingFieldEventArgs e)
{
if
(e.PropertyName ==
"ID"
)
{
e.DataField.Template =
this
.Resources[
"DataFormDataFieldTemplate"
]
as
ControlTemplate;
}
}
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
You may predefine the template using Expression Blend. You need to change the original template like so:
....
<
Grid
x:Name
=
"PART_DataFormDataFieldGrid"
Margin
=
"{TemplateBinding Padding}"
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
/>
<
ColumnDefinition
Width
=
"24"
/>
</
Grid.ColumnDefinitions
>
<
Grid.RowDefinitions
>
<
RowDefinition
/>
<
RowDefinition
/>
</
Grid.RowDefinitions
>
<!--<TextBlock x:Name="PART_Label" Margin="5,0" Text="{TemplateBinding Label}"/>-->
<
ContentPresenter
x:Name
=
"PART_ContentPresenter"
Content
=
"{TemplateBinding Content}"
Grid.Column
=
"0"
HorizontalAlignment
=
"{TemplateBinding HorizontalContentAlignment}"
Margin
=
"5,0"
Grid.Row
=
"1"
VerticalAlignment
=
"{TemplateBinding VerticalContentAlignment}"
/>
<
Grid
x:Name
=
"DescriptionIcon"
Grid.Column
=
"1"
Height
=
"16"
Margin
=
"4,0"
Grid.Row
=
"1"
Visibility
=
"{Binding Description, Converter={StaticResource DescriptionVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}"
Width
=
"16"
>
....
In the code snippet I have commented the "PART_Label" part and I have changed the column definitions for the container's Grid.
Regards,
Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Error 1 Cannot find the static member 'ContentProperty' on the type 'Control'.
I have attached a sample project. It is for Silverlight, but you should do the same for your WPF project.
Greetings,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
May you please send me how exactly have you predefined the template?
All the best,Didie
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>