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.
Unfortunately, activation email could not send to your email. Please try again.

displaying child rows without indenting

Thread ID:

Created:

Updated:

Platform:

Replies:

131229 Jun 29,2017 08:47 AM Jul 3,2017 08:42 AM UWP 1
loading
Tags: SfTreeGrid
Siju.P.Sukumar
Asked On June 29, 2017 08:47 AM

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

Jai Ganesh S [Syncfusion]
Replied On July 3, 2017 08:42 AM

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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;