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

Unable to hide/remove GridView left border line

2 Answers 339 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 1
Iron
Veteran
Iron
Joe asked on 26 Dec 2018, 09:40 PM
I've been trying to use RadGridView to display a relatively simple list of data.  No grouping, sorting or even selecting of cells allowed.  I tried to customize it to not show any borders or grid lines and use my custom background  but I seem to be unable to get rid of a single vertical line along the left side of the grid.

I've tried to do this by turning off all borders and make all of my backgrounds use the dark background color you can see in the image.  (a static resource brush named "GsBackgroundDark")  I tried to set the default styles of all of the element types that the grid apppears to use (GridViewCell, GridViewHeaderCell, etc).  But clearly I'm missing something.

Can you tell me what else I need to do?

I have attached an image showing you what I see.  What am I missing to get rid of that line on the left?

Below is  the XAML I'm using

<Window x:Class="TestApp.MainWindow"
        mc:Ignorable="d"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:gl="clr-namespace:TestApp"
        xmlns:net="http://schemas.gelsight.com/mobile/net"
        Title="MainWindow"
        >
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Colors.xaml"/>
            </ResourceDictionary.MergedDictionaries>
 
            <gl:MainWindowVm x:Key="ViewModel"/>
 
 
            <Style TargetType="{x:Type tk:GridViewCell}">
                <Setter Property="Background" Value="{StaticResource GsBackgroundDark}"/>
                <Setter Property="BorderBrush" Value="Transparent"/>
                <Setter Property="SelectedBackground" Value="{StaticResource GsBackgroundDark2}"/>
                <Setter Property="BorderThickness" Value="0"/>
            </Style>
            <Style TargetType="{x:Type tk:GridViewHeaderCell}">
                <Setter Property="Background" Value="{StaticResource GsBackgroundDark}"/>
                <Setter Property="BorderBrush" Value="Transparent"/>
                <Setter Property="BorderThickness" Value="0"/>
            </Style>
            <Style TargetType="{x:Type tk:GridViewSearchPanel}">
                <Setter Property="Background" Value="{StaticResource GsBackgroundDark}"/>
                <Setter Property="BorderBrush" Value="Transparent"/>
                <Setter Property="BorderThickness" Value="0"/>
            </Style>
            <Style TargetType="{x:Type tk:GridViewGroupPanel}">
                <Setter Property="Background" Value="{StaticResource GsBackgroundDark}"/>
                <Setter Property="BorderBrush" Value="Transparent"/>
                <Setter Property="BorderThickness" Value="0"/>
            </Style>
            <Style TargetType="{x:Type tk:GridViewScrollViewer}">
                <Setter Property="Background" Value="{StaticResource GsBackgroundDark}"/>
                <Setter Property="BorderBrush" Value="Transparent"/>
                <Setter Property="BorderThickness" Value="0"/>
            </Style>
        </ResourceDictionary>
    </Window.Resources>
    <Grid DataContext="{StaticResource ViewModel}">
     
        <tk:RadGridView      ItemsSource="{Binding Licenses}"
                        CanUserGroupColumns="False"
                        CanUserSearch="False"
                        Background="{StaticResource GsBackgroundDark}"
                        Foreground="{StaticResource GsForegroundLight}"
                        ColumnsSelectionButtonVisibility="Collapsed"
                        BorderThickness="0"
                        BorderBrush="{StaticResource GsBackgroundDark}"
                        ShowGroupPanel="False"
                        ShowColumnSortIndexes="False"
                        ShowSearchPanel="False"
                        ShowColumnFooters="False"
                        ShowGroupFooters="False"
                        CanUserSelectColumns="False"
                        Padding="0"
                        CanUserResizeColumns="False"
                        CanUserSearchInHiddenColumns="False"
                        DataLoadMode="Asynchronous"
                        Focusable="False"
                        GridLinesVisibility="None"
                        IsFilteringAllowed="False"
                        RowIndicatorVisibility="Collapsed"
                        CanUserSortColumns="False"
                        CanUserReorderColumns="False"
                        AutoGenerateColumns="False"
                        IsHitTestVisible="False"
                        CanUserSelect="False"
                        MaxWidth="500" Style="{DynamicResource RadGridViewStyle1}"  
                        SearchPanelForeground="{StaticResource GsForegroundLight}"
                        SearchPanelBackground="{StaticResource GsBackgroundDark}"
                        ColumnBackground="{StaticResource GsBackgroundDark}"
                        GroupPanelBackground="{StaticResource GsBackgroundDark}"
                        GroupPanelForeground="{StaticResource GsForegroundLight}"
                        AlternateRowBackground="{StaticResource GsBackgroundDark}"
                        >
            <tk:RadGridView.HeaderRowStyle>
                <Style TargetType="{x:Type tk:GridViewHeaderRow}">
                    <Setter Property="Background" Value="{StaticResource GsBackgroundDark}"/>
                    <Setter Property="BorderBrush" Value="Transparent"/>
                    <Setter Property="Foreground" Value="{StaticResource GsForegroundLight}"/>
                    <Setter Property="BorderThickness" Value="0"/>
                    <Setter Property="FontSize" Value="20"/>
                    <Setter Property="FontWeight" Value="Bold"/>
                </Style>
            </tk:RadGridView.HeaderRowStyle>
            <tk:RadGridView.Columns>
                <tk:GridViewDataColumn Header="Feature" Width="Auto" DataMemberBinding="{Binding Feature}" />
                <tk:GridViewDataColumn Header="Version" Width="Auto" DataMemberBinding="{Binding Version}"/>
                <tk:GridViewDataColumn Header="Expires" Width="1*" DataMemberBinding="{Binding Expires}"/>
            </tk:RadGridView.Columns>
        </tk:RadGridView>
    </Grid>
</Window>

2 Answers, 1 is accepted

Sort by
0
Joe
Top achievements
Rank 1
Iron
Veteran
Iron
answered on 26 Dec 2018, 09:55 PM
One minor correction from above.  The line in which I set the GridView's style is actually not there anymore (It was leftover from my testing settings via copying the template. 

In other words,  That line above that reads like this:

MaxWidth="500" Style="{DynamicResource RadGridViewStyle1}"  


Is actually just this:

MaxWidth="500"
0
Accepted
Yoan
Telerik team
answered on 27 Dec 2018, 07:21 AM
Hello Joe,

Generally, you can check the Visual Structure help article of RadGridView if you are not sure what are some visual elements.

For your particular question - This line is grid's frozen column indicator. It can be dragged in order to freeze some columns. If you do not need it, you can turn off the feature(it is turned on by default) by setting CanUserFreezeColumns property of RadGridView to False.

Regards,
Yoan
Progress Telerik
Get quickly and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
GridView
Asked by
Joe
Top achievements
Rank 1
Iron
Veteran
Iron
Answers by
Joe
Top achievements
Rank 1
Iron
Veteran
Iron
Yoan
Telerik team
Share this question
or