Click here to Skip to main content
11,573,935 members (63,990 online)
Click here to Skip to main content

Tagged as

DataGrid Visual Column Separator

, 6 Aug 2013 CPOL 7.7K 6
Rate this:
Please Sign up or sign in to vote.
DataGrid column separator


I had to visually separate my DataGrid in two different parts. I used XAML to do so and added a small unused column. I searched for a solution but I didn't find anything that would solve my problem.

Using the Code

It is very simple, all in XAML. You just need to add a column and change the Header and Cell style.

<DataGridTemplateColumn MinWidth="4" MaxWidth="4" 
IsReadOnly="True" CanUserResize="False">
        <Style TargetType="{x:Type DataGridColumnHeader}">
            <Setter Property="Margin" Value="-1" />
            <Setter Property="Background" Value="Black" />
            <Setter Property="BorderBrush" Value="Black" />
            <Setter Property="BorderThickness" Value="2" />
        <Style TargetType="{x:Type DataGridCell}">                       
            <Setter Property="BorderBrush" Value="Black" />
            <Setter Property="BorderThickness" Value="2" />                          
            <Setter Property="Focusable" Value="False" />

With this separator, you can't use arrow to go between the two parts of the DataGrid but with Tab it is alright.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer
Switzerland Switzerland
After graduating I started working as a Software Developer for a timing and scoring company.

You may also be interested in...

Comments and Discussions

SuggestionPicture would be nice? Pin
Silvabolt31-Jul-13 9:02
memberSilvabolt31-Jul-13 9:02 
QuestionThis isn't ASP.NET... Pin
rbegley131-Jul-13 4:03
memberrbegley131-Jul-13 4:03 
AnswerRe: This isn't ASP.NET... Pin
Ced7435-Aug-13 22:39
professionalCed7435-Aug-13 22:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.150624.2 | Last Updated 6 Aug 2013
Article Copyright 2013 by Ced743
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid