<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?
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 >>
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 >>
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 >>