We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

displaying child rows without indenting

Hi,

  How can i display child rows of a sfTreegrid without indenting . I wnted to display the child rows stating at the same level of parent nodes without indenting

Thanks&Regards
Siju

1 Reply

JG Jai Ganesh S Syncfusion Team July 3, 2017 12:42 PM UTC

Hi Siju, 
You can achieve your requirement for showing the SfTreeGrid child rows without indenting by customizing the style for TreeGridExpanderCell and removing the indent Margin, 
<Style TargetType="syncfusion:TreeGridExpanderCell"> 
                <Setter Property="Background" Value="Transparent" /> 
                <Setter Property="BorderThickness" Value="0,0,1,1" /> 
                <Setter Property="BorderBrush" Value="Gray" /> 
                <Setter Property="Padding" Value="0" /> 
                <Setter Property="Template"> 
                    <Setter.Value> 
                        <ControlTemplate TargetType="syncfusion:TreeGridExpanderCell"> 
                            <Grid x:Name="Root" 
                          BorderBrush="{TemplateBinding BorderBrush}"  Background="{TemplateBinding Background}" 
                          BorderThickness="{TemplateBinding BorderThickness}"> 
                                <VisualStateManager.VisualStateGroups> 
                                    <VisualStateGroup x:Name="IndicationStates"> 
                                        <VisualState x:Name="NoError" /> 
                                        <VisualState x:Name="HasError"> 
                                            <VisualState.Setters> 
                                                <Setter Target="PART_InValidCellBorder.Visibility" Value="Visible" /> 
                                            </VisualState.Setters> 
                                        </VisualState> 
                                    </VisualStateGroup> 
                                    <VisualStateGroup x:Name="CurrentStates"> 
                                        <VisualState x:Name="Regular" /> 
                                        <VisualState x:Name="Current"> 
                                            <VisualState.Setters> 
                                                <Setter Target="PART_CurrentCellBorder.Visibility" Value="Visible" /> 
                                            </VisualState.Setters> 
                                        </VisualState> 
                                    </VisualStateGroup> 
                                </VisualStateManager.VisualStateGroups> 
                                <Grid Margin="{TemplateBinding IndentMargin}"> 
                                    <Grid.ColumnDefinitions> 
                                        <ColumnDefinition Width="18" /> 
                                        <ColumnDefinition Width="Auto" /> 
                                        <ColumnDefinition Width="*" /> 
                                    </Grid.ColumnDefinitions> 
                                    <syncfusion:TreeGridExpander x:Name="PART_ExpanderCell" 
                                                    Grid.Column="0" 
                                                    Width="16" 
                                                    Height="16" 
                                                    Margin="2,1,0,1" 
                                                    HorizontalAlignment="Center" 
                                                    VerticalAlignment="Center" 
                                                    IsExpanded="{Binding RelativeSource={RelativeSource TemplatedParent}, 
                                                                         Path=IsExpanded, 
                                                                         Mode=TwoWay, 
                                                                         UpdateSourceTrigger=PropertyChanged}" 
                                                    Visibility="{Binding RelativeSource={RelativeSource TemplatedParent}, 
                                                                         Path=HasChildNodes, 
                                                                         Converter={StaticResource VisiblityConverter}, 
                                                                         Mode=TwoWay}" /> 
 
                                    <CheckBox Name="PART_SelectCheckBox" 
                                      Grid.Column="1" 
                                      Width="18" 
                                      Height="18" 
                                      MinWidth="22" 
                                      Margin="2,0,0,0" 
                                      HorizontalAlignment="Center" 
                                      VerticalAlignment="Center" 
                                      IsEnabled="{Binding RelativeSource={RelativeSource TemplatedParent}, 
                                                          Path=IsCheckBoxEnabled, 
                                                          Mode=TwoWay, 
                                                          UpdateSourceTrigger=PropertyChanged}" 
                                      IsTabStop="False" 
                                      IsThreeState="True" 
                                      Visibility="{Binding Path=ColumnBase.Renderer.TreeGrid.ShowCheckBox, 
                                                           RelativeSource={RelativeSource Mode=TemplatedParent}, 
                                                           Converter={StaticResource VisiblityConverter}, 
                                                           Mode=TwoWay}" /> 
 
 
                                    <Grid Grid.Column="2" 
                                  Margin="2,0,0,0"> 
                                        <ContentPresenter /> 
                                        <Border x:Name="PART_CurrentCellBorder" 
                                        Margin="1,0,0,0" 
                                        Background="Transparent" 
                                        BorderBrush="{TemplateBinding CurrentCellBorderBrush}" 
                                        BorderThickness="{TemplateBinding CurrentCellBorderThickness}" 
                                        IsHitTestVisible="False" 
                                        Visibility="Collapsed" /> 
                                        <Border x:Name="PART_InValidCellBorder" 
                                        Width="10" 
                                        Height="10" 
                                        HorizontalAlignment="Right" 
                                        VerticalAlignment="Top" 
                                        Visibility="Collapsed"> 
                                            <ToolTipService.ToolTip> 
 
                                                <ToolTip Background="#FFDB000C" 
                                                 Placement="Right" 
                                                 Tag="{TemplateBinding ErrorMessage}" 
                                                 Template="{StaticResource ValidationToolTipTemplate}" /> 
 
                                            </ToolTipService.ToolTip> 
                                            <Path Data="M0.5,0.5 L12.652698,0.5 12.652698,12.068006 z" 
                                          Fill="Red" 
                                          Stretch="Fill" /> 
                                        </Border> 
                                    </Grid> 
                                </Grid> 
                            </Grid> 
                        </ControlTemplate> 
                    </Setter.Value> 
                </Setter> 
            </Style> 
 
Screen Shot: 
 
Regards, 
Jai Ganesh S 


Loader.
Live Chat Icon For mobile
Up arrow icon