Problem re-templating grouprowheader

4 posts, 0 answers
  1. Neil
    Neil avatar
    10 posts
    Member since:
    Apr 2011

    Posted 14 Sep 2011 Link to this post

    <ControlTemplate x:Key="GridViewGroupRowTemplate" TargetType="telerik:GridViewGroupRow">
          <Grid x:Name="PART_GroupExpanderGrid">
             <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
             </Grid.ColumnDefinitions>
             <Grid.RowDefinitions>
                <RowDefinition x:Name="PART_HeaderRow" />
             </Grid.RowDefinitions>
      
             <Border x:Name="ToggleButtonBorder" Background="{TemplateBinding Background}" Grid.Column="1" MinHeight="{TemplateBinding MinHeight}" 
                BorderThickness="0,0,1,1" BorderBrush="Gray">
                <Grid>
                   <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="180"/>
                      <ColumnDefinition Width="*"/>
                   </Grid.ColumnDefinitions>
      
                   <Border Grid.Column="0" BorderThickness="0,0,1,1" BorderBrush="{TemplateBinding BorderBrush}">
                      <Grid>
                         <telerik:RadButton  
                               Margin="4,2,0,0"
                               HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Height="12" Content="+"
                               IsTabStop="False"/>
                         <telerik:RadButton 
                               Margin="17,2,0,0"
                               HorizontalAlignment="Left" VerticalAlignment="Top" Width="12" Height="12" Content="-"
                               IsTabStop="False"/>
      
                         <ContentControl x:Name="HeaderButton" telerik:SelectiveScrollingGrid.SelectiveScrollingOrientation="Vertical" Margin="36,2,0,0">
                            <ContentPresenter ContentTemplate="{TemplateBinding GroupHeaderTemplate}" Content="{TemplateBinding GroupViewModel}" Margin="0,0,10,0" VerticalAlignment="Center"/>
                         </ContentControl>
                      </Grid>
                   </Border>
                   <Border x:Name="Content" Grid.Column="1" Visibility="Visible">
                      <StackPanel>
                         <telerik:GridViewVirtualizingPanel x:Name="PART_GridViewVirtualizingPanel"/>
                      </StackPanel>
                   </Border>
      
                </Grid>
             </Border>
          </Grid>
       </ControlTemplate>

    I've applied the above template to my RadGridView, in an attempt to move the GroupHeaderRow to the left of the rows its grouping as opposed to the side. All works well until the grid becomes larger than the target area (in a floating rad pane) and I get artifacts like those in the attached screenshots (the grey lines covering rows).

    The Grouping works excellently, but I really need to change the layout - am I on the right path?
  2. Neil
    Neil avatar
    10 posts
    Member since:
    Apr 2011

    Posted 15 Sep 2011 Link to this post

    Is restyling the grid in this way not supported? All I'm trying to achieve is to move the grouping bar from the top level to the left hand side.
  3. Neil
    Neil avatar
    10 posts
    Member since:
    Apr 2011

    Posted 19 Sep 2011 Link to this post

    Is moving the grouping header to the left not supported by telerik?
  4. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 20 Sep 2011 Link to this post

    Hi Neil,

     

    Sorry for the late reply! I will try to explain the specific cases in the defined style. 
    The dark grayed border to the bottom, which comes from the Border named ToggleButtonBorder. You may remove it through resetting its BorderThickness, as shown below:

    <Border x:Name="ToggleButtonBorder" Background="{TemplateBinding Background}" Grid.Column="1" MinHeight="{TemplateBinding MinHeight}"
               BorderThickness="0,0,1,0" BorderBrush="Gray">


    Then you may see the result at the attached picture GroupingRow.png. Furthermore you have changed the postion of a plain GridViewRow and when you have perform grouping you may see the indent cells as well, you may refer to the picture named IndentRow.png. If you do not need this indentation just create a style targeted at GridViewIndentCell and set its Visibility property to Collapsed:

    <Style TargetType="telerik:GridViewIndentCell">
        <Setter Property="Visibility" Value="Collapsed"/>
    </Style>


    Please keep in mind that RadGridView is a virtual component and it is not designed to work in case when the grouping header is docked to the left. I would recommend you keep the default behavior of GridViewGroupRow. I am attaching you the testing project for further reference! 


    Hope this helps!




    Best wishes,
    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top