Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6750377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:48:00+00:00 2026-05-26T12:48:00+00:00

i am building an application in WPF for a custom need. First i opted

  • 0

i am building an application in WPF for a custom need. First i opted for custom controls, but later on figured out that much of what i needed was already implemented in Datagrid Control. However there is one small glitch:

The problem with Datagrid is that it enforces a minimum of 2 pixel gap between two consecutive cells (1 on each side of the Grid Line). Please have a look at the following diagram for clarity:

.
Please note the 2 pixels gap enforced by the Datagrid between the two consecutive cells:
http://img265.imageshack.us/img265/3545/figurem.png

(Stack overflow wouldn’t let me add image to my question citing a spam protection policy for new users)

.

This doesn’t suit my requirement as i want the content to appear “continuous” (There must not be this gap of 2 pixels; i want the connecting lines to look “connected”). i’ve tried fidgeting with the GridLinesVisibility, but it didn’t help. The DataGrid is hosting a custom control like this:

<DataGrid.Columns>
            <DataGridTemplateColumn Width="25" Header="">
                <DataGridTemplateColumn.CellTemplate>
                    <DataTemplate>
                        <ContentControl Content="{Binding Path=MyCustomControl}" Margin="0"></ContentControl>
                    </DataTemplate>
                </DataGridTemplateColumn.CellTemplate>
            </DataGridTemplateColumn>

....
</DataGrid.Columns>

i have so far tried:

  1. Switching off the GridLine (see result here: http://img263.imageshack.us/img263/8602/figure2j.png)
  2. Setting the margin of the content property to 0.
  3. Searched google and stackoverflow
  4. Consulted some books.

but nothing seems to come up.

Is there a solution to this/some hack or a workaround or would i have to create everything from scratch? i have decent experience with c#, but i am new to WPF.

Please Help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T12:48:01+00:00Added an answer on May 26, 2026 at 12:48 pm

    What you need to do is get at the DataGridCell style for your DataGrid and set its BorderThickness to be 0. It’s hard-coded as 1 in the default style, but fortunately it’s easy to override this:

    <Style TargetType="DataGridCell">
        <Setter Property="BorderThickness" Value="0" />
    </Style>
    

    I would suggest putting that into the resources of your DataGrid so it only affects that one grid, unless you want it to have a wider scope than that.

    <DataGrid>
        <DataGrid.Resources>
            <Style TargetType="DataGridCell">...</Style>
        </DataGrid.Resources>
        ...
    </DataGrid>
    

    There are other places you could put it as well, depending on your precise needs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We were building out the next version of an in-house thick-client application using WPF/Prism
I'm building an application using WPF that will be a designer of sorts, meaning,
I am building a WPF application that calls web services and displays the data
I am building a WPF application using C#. I want to pop out a
I'm building a custom Windows installer package for my .NET 3.5 SP1 WPF application.
I am building an application that has a WCF service that a WPF and
I am building a WPF application in which I need to open one of
I'm building a WPF application in which I need to display document previews such
I'm building a WPF application that is designed to act as a notification toolbar
I'm in the process of building my first real WPF application (i.e., the first

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.