<Setter Property="FontSize" Value="14" />There is an issue when the GridViewCell is in Edit mode, the row's height will be heighter than others.
I found that the textBox in edit mode has an padding whose value is "2,2,2,2"。 How can i change the textBox's padding value.
Or what can I do to set the rows in the same height.
Waiting for your help.
11 Answers, 1 is accepted
When the GridViewCell goes into edit mode the standard TextBox control appeared. You may create an implicit style targeted at a single TextBox and set the desired properties from there. RadGridView will handle these settings correspondingly. Furthermore if you want to set a fixed height for all rows you may do this through setting RadGridView's RowHeight property to a desired value.
Hope this helps!
Vanya Pavlova
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
But i really don't how to let the gridviewcell to know which textBox style to use.
And can you give me an example.
Any code is helpful.
<Style TargetType="TextBox"> <Setter Property="Padding" Value="0"/> </Style>
I add style like this,but it is useless.
Take a look at this, what should i do.
Does anyone have answer for this?
Does anyone have answer for this?
has there been any update that resolves this problem?
Greetings
Sven
For the time being as a kind of workaround I may suggest you to manually set the template of the TextBox as shown below:
<
UserControl.Resources
>
<
ControlTemplate
x:Key
=
"s1"
TargetType
=
"TextBox"
>
<
Border
Background
=
"Yellow"
BorderBrush
=
"Red"
BorderThickness
=
"1"
CornerRadius
=
"0"
>
<
ContentPresenter
Content
=
"{TemplateBinding Text}"
/>
</
Border
>
</
ControlTemplate
>
</
UserControl.Resources
>
<
Grid
x:Name
=
"LayoutRoot"
Background
=
"White"
>
<
telerik:RadGridView
Name
=
"radGridView"
AutoGenerateColumns
=
"False"
ItemsSource
=
"{Binding}"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"Name"
DataMemberBinding
=
"{Binding Name}"
>
<
telerik:GridViewDataColumn.CellTemplate
>
<
DataTemplate
>
<
TextBlock
Text
=
"{Binding Name}"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellTemplate
>
<
telerik:GridViewDataColumn.CellEditTemplate
>
<
DataTemplate
>
<
TextBox
Text
=
"{Binding Name}"
Template
=
"{StaticResource s1}"
/>
</
DataTemplate
>
</
telerik:GridViewDataColumn.CellEditTemplate
>
</
telerik:GridViewDataColumn
>
<
telerik:GridViewDataColumn
Header
=
"Est."
DataMemberBinding
=
"{Binding Established}"
/>
<
telerik:GridViewDataColumn
Header
=
"Stadium"
DataMemberBinding
=
"{Binding StadiumCapacity}"
DataFormatString
=
"{}{0:N0}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
</
Grid
>
Vanya Pavlova
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Is there also a generic way to solve this? I use an inherited version of RadGridView so I could customize code there...
Thank you
Sven
You have a variety of options to access the columns in your inherited grid and set the desired DataTemplate from code-behind. Within this template you may set the desired ControlTemplate of the TextBox to achieve your goal.
Vanya Pavlova
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
could you please provide a short code snippet to give me a little jump start?
Thanks again
Sven
I have prepared very simple and basic example which demonstrates how to achieve this.
Please take a look at the attachment and let me know if you need any additional information.
Vanya Pavlova
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>