How to disable cell highlighting in Q2 2010

6 posts, 0 answers
  1. Helene Lach
    Helene Lach avatar
    15 posts
    Member since:
    Nov 2009

    Posted 14 Jul 2010 Link to this post

    In the past I have been using a style snippet I found on this forum to help get rid of the default cell highlighting in my gridviews. I just upgraded to Q2 2010, and the code does not compile any more - it appears AlignmentContentPresenter has been marked obsolete and removed. How can I achieve the same functionality with this new version? Here is the code I use in my styles.xaml:

     

    <LinearGradientBrush x:Key="GridViewRowSelectedCell" EndPoint="0.5,1" StartPoint="0.5,0">
         <GradientStop Color="#FFFFFDF9" Offset="0"/>
         <GradientStop Color="#FFFFEDC7" Offset="1"/>
     </LinearGradientBrush>
     <SolidColorBrush x:Key="GridViewDisabledBackground" Color="#FFEEEEEE"/>
     <SolidColorBrush x:Key="GridViewDisabledBorderBrush" Color="#FFBBBBBB"/>
     <ControlTemplate x:Key="GridViewCellTemplate" TargetType="RadGrid:GridViewCell">
         <Border x:Name="PART_CellBorder" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
             <VisualStateManager.VisualStateGroups>
                 <VisualStateGroup x:Name="CommonStates">
                     <VisualState x:Name="Normal"/>
                     <VisualState x:Name="Current">
                         <Storyboard>
                             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_CellBorder" Storyboard.TargetProperty="Background">
                                 <DiscreteObjectKeyFrame KeyTime="0:0:0">
                                     <DiscreteObjectKeyFrame.Value>
                                         <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                             <GradientStop Color="#00FFFDF9" Offset="0"/>
                                             <GradientStop Color="#00FFEDC7" Offset="1"/>
                                         </LinearGradientBrush>
                                     </DiscreteObjectKeyFrame.Value>
                                 </DiscreteObjectKeyFrame>
                             </ObjectAnimationUsingKeyFrames>
                         </Storyboard>
                     </VisualState>
                 </VisualStateGroup>
                 <VisualStateGroup x:Name="EditingStates">
                     <VisualState x:Name="Edited">
                         <Storyboard>
                             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="Margin">
                                 <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="0"/>
                             </ObjectAnimationUsingKeyFrames>
                             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_ContentPresenter" Storyboard.TargetProperty="VerticalAlignment">
                                 <DiscreteObjectKeyFrame KeyTime="0:0:0" Value="Stretch"/>
                             </ObjectAnimationUsingKeyFrames>
                         </Storyboard>
                     </VisualState>
                     <VisualState x:Name="Display"/>
                 </VisualStateGroup>
                 <VisualStateGroup x:Name="DisabledStates">
                     <VisualState x:Name="Enabled"/>
                     <VisualState x:Name="Disabled">
                         <Storyboard>
                             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_CellBorder" Storyboard.TargetProperty="Background">
                                 <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource GridViewDisabledBackground}"/>
                             </ObjectAnimationUsingKeyFrames>
                             <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PART_CellBorder" Storyboard.TargetProperty="BorderBrush">
                                 <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource GridViewDisabledBorderBrush}"/>
                             </ObjectAnimationUsingKeyFrames>
                         </Storyboard>
                     </VisualState>
                 </VisualStateGroup>
             </VisualStateManager.VisualStateGroups>
             <RadGrid:AlignmentContentPresenter x:Name="PART_ContentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Visibility="Visible" Foreground="{TemplateBinding Foreground}" TextAlignment="{TemplateBinding TextAlignment}" TextDecorations="{TemplateBinding TextDecorations}" TextWrapping="{TemplateBinding TextWrapping}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
         </Border>
     </ControlTemplate>
     <SolidColorBrush x:Key="GridLinesFill" Color="#FFB3B3B3"/>
       
     <Style x:Key="GridViewCellStyle" TargetType="RadGrid:GridViewCell">
         <Setter Property="Template" Value="{StaticResource GridViewCellTemplate}"/>
         <Setter Property="Padding" Value="5,0,3,0"/>
         <Setter Property="BorderBrush" Value="{StaticResource GridLinesFill}"/>
         <Setter Property="BorderThickness" Value="0,0,1,0"/>
         <Setter Property="VerticalContentAlignment" Value="Center"/>
         <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
         <Setter Property="Background" Value="Transparent"/>
     </Style>

     

     

     

    Thanks in advance for your help.

  2. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 15 Jul 2010 Link to this post

    Hi,

     You can edit the same template with Blend and again remove desired states/elements. 

    Greetings,
    Vlad
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. David Brubacher
    David Brubacher avatar
    29 posts
    Member since:
    Mar 2010

    Posted 23 Jul 2010 Link to this post

    Can you elaborate on that a bit? I'm afraid I don't understand how you advice applies.
  5. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 29 Jul 2010 Link to this post

    Hello,

     The idea is to get the new template exactly in the same way as the old template - from Blend. How did you get the old template?

    Best wishes,
    Vlad
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Chris
    Chris avatar
    26 posts
    Member since:
    Jun 2010

    Posted 13 Oct 2010 Link to this post

    Hey guys,

    one question about this xaml code above.

    How can i edit this style from blend? I got exactly the same problem and i´m tried to delete the cell highlighting.

    Thanks in advance.

  7. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 13 Oct 2010 Link to this post

    Hello Chris,

    Considering the topic how to edit the style of GridViewCell please see the following article Styling a Cell. In addition to this article I have prepared an example for you that demonstrates how to remove states from GridViewCell.

    Please see the attached and let me know if you need any additional information.

    Regards,
    Vanya Pavlova
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top
DevCraft banner