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

[Solved] change edit cell border colour

4 Answers 188 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
felix
Top achievements
Rank 1
felix asked on 17 Nov 2010, 12:52 PM
Hi there, 

I've looked everywhere but cannot find this border (with white background and yellow border) when you are editing a cells value - screen attached.

I would have assumed it would be in the GridViewCell template, under the edit  state, but it isn't. I can't even find it with silverlight spy.

Any ideas?

Thanks!

felix

4 Answers, 1 is accepted

Sort by
0
Accepted
Vanya Pavlova
Telerik team
answered on 18 Nov 2010, 08:20 AM
Hello Felix,

When a GridViewCell goes into edit mode the TextBox appeared and the eaisest way to change this behavior is to define an editor style for that column which represents a simple style targeted at TextBox.
You can use the following markup:
 
<UserControl
    x:Class="SilverlightApplication201.MainPage"
    Width="640" Height="480">
    <UserControl.Resources>
        <Style x:Key="a1" TargetType="TextBox">
              <Setter Property="BorderBrush" Value="Black"/>
                  <Setter Property="Background" Value="Red"/>
            </Style>
</UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource SampleDataSource}}">
        <telerik:RadGridView x:Name="grid"   ItemsSource="{Binding Collection}" Margin="0,0,0,131">
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn EditorStyle="{StaticResource a1}" Header="ID" DataMemberBinding="{Binding Property1}"/>
                <telerik:GridViewDataColumn Header="CompanyName" DataMemberBinding="{Binding Property2}"/>
                <telerik:GridViewDataColumn Header="Address" DataMemberBinding="{Binding Property3}"/>
                <telerik:GridViewHyperlinkColumn Header="Website" DataMemberBinding="{Binding Property4}"/>
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>
      
          
    </Grid>
</UserControl>
 
You can customize it to meet your personal requirements.

Best wishes,
Vanya Pavlova
the Telerik team
See What's New in RadControls for Silverlight in Q3 2010 on Tuesday, November 16, 2010 11:00 AM - 12:00 PM EST or 10:00 PM - 11:00 PM EST: Register here>>
0
felix
Top achievements
Rank 1
answered on 18 Nov 2010, 03:09 PM
That works, thanks :)

Is there a way to set this style explicitly? Without having to set the EditorStyle on every column?

Thanks again!

felix
0
Vanya Pavlova
Telerik team
answered on 19 Nov 2010, 08:59 AM
Hi Felix,

 

Just remove the x:Key within the style that is targeted at TextBox and you will not need to specify the EditorStyle property in any column.

Sincerely yours,
Vanya Pavlova
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
felix
Top achievements
Rank 1
answered on 19 Nov 2010, 05:48 PM
Thanks, but that will change all textboxes, not just editorstyle checkboxes. Nevermind, thanks for the help anyway :)
Tags
GridView
Asked by
felix
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
felix
Top achievements
Rank 1
Share this question
or