Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. WPF
  4. WPF DataGrid: Clipping on ColumnHeadersPresenter

WPF DataGrid: Clipping on ColumnHeadersPresenter

Scheduled Pinned Locked Moved WPF
wpfcsharpcsswcfcom
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mikey_H
    wrote on last edited by
    #1

    Hello, I am having some issues with the display of the DataGridColumnHeadersPresenter in my custom DataGrid template. Example Screenshots I have taken the original ControlTemplate for DataGrid and altered the area related to the DataGridColumnHeadersPresenter and the select all Button. What I am experiencing when I load the application (Figure A) is the area taken up by the DataGridColumnHeadersPresenter is longer than it should be (on the right side) by 2 pixels (or whatever the margin is set to). It also appears clipped as it does not show the right side border or the corner radii. When I adjust the size of the window at runtime using the Window 'resizing handles' (Figure B) the appearance changes and the DataGridColumnHeadersPresenter appears as I expect it to. However when I resize it small enough so that the DataGrid's horizontal scroll becomes active (Figure C) it again appears clipped, this time being a few pixels shorter than the expected length. Custom Row, RowHeader, Cell and ColumnHeader styles are also in use, but removing them does not change this problem. Original

    <!--Left Column Header Corner -->
    <Button Command="{x:Static dg:DataGrid.SelectAllCommand}"
    Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type dg:DataGrid}}, Path=CellsPanelHorizontalOffset}"
    Template="{StaticResource SelectAllButtonTemplate}"
    Focusable="false"
    Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type dg:DataGrid}},
    Path=HeadersVisibility,
    Converter={x:Static dg:DataGrid.HeadersVisibilityConverter},
    ConverterParameter={x:Static dg:DataGridHeadersVisibility.All}}" />
    <!--Column Headers-->
    <dgp:DataGridColumnHeadersPresenter Grid.Column="1"
    Name="PART_ColumnHeadersPresenter"
    Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type dg:DataGrid}},
    Path=HeadersVisibility,
    Converter={x:Static dg:DataGrid.HeadersVisibilityConverter},
    ConverterParameter={x:Static dg:DataGridHeadersVisibility.Column}}"/>

    My Changes

    <tkp:DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter"

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups