Click here to Skip to main content
15,890,882 members
Home / Discussions / WPF
   

WPF

 
QuestionHost a new page [modified] Pin
Yonathan111122-Feb-10 21:29
professionalYonathan111122-Feb-10 21:29 
AnswerRe: Host a new page Pin
ToddHileHoffer24-Feb-10 6:57
ToddHileHoffer24-Feb-10 6:57 
QuestionPrinting nested WPF Custom Controls to XPS (and PDF) Pin
mmsinclair22-Feb-10 5:10
mmsinclair22-Feb-10 5:10 
QuestionHow I get Application_Exit Eventhandler in javascript code Pin
xodeblack22-Feb-10 4:24
xodeblack22-Feb-10 4:24 
AnswerRe: How I get Application_Exit Eventhandler in javascript code Pin
Daniel Vaughan25-Feb-10 7:04
Daniel Vaughan25-Feb-10 7:04 
Questionsilverlight (strange) [modified] Pin
Yonathan111121-Feb-10 21:21
professionalYonathan111121-Feb-10 21:21 
QuestionChildWindow Odd Behaviour Pin
Jammer21-Feb-10 6:36
Jammer21-Feb-10 6:36 
QuestionWPF DataGrid: Clipping on ColumnHeadersPresenter Pin
Mikey_H20-Feb-10 20:52
Mikey_H20-Feb-10 20:52 
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"
                                                        Grid.Column="1">
                      <tkp:DataGridColumnHeadersPresenter.Template>
                        <ControlTemplate TargetType="{x:Type tkp:DataGridColumnHeadersPresenter}">
                          <Border Background="{Binding Path=AlternatingRowBackground, 
                                                  RelativeSource={RelativeSource AncestorType={x:Type tk:DataGrid}}}"
                                  BorderBrush="#FFB4B4B4"
                                  BorderThickness="0,1,1,1"
                                  CornerRadius="0,2,2,0"
                                  Margin="0,0,2,1">
                            <ItemsPresenter/>
                          </Border>
                        </ControlTemplate>
                      </tkp:DataGridColumnHeadersPresenter.Template>
                    </tkp:DataGridColumnHeadersPresenter>
                    <Border Background="{Binding Path=AlternatingRowBackground, 
                                        RelativeSource={RelativeSource AncestorType={x:Type tk:DataGrid}}}"
                            BorderBrush="#FFB4B4B4"
                            BorderThickness="1"
                            CornerRadius="2,0,0,2"
                            Margin="0,0,0,1"
                            Width="{Binding Path=CellsPanelHorizontalOffset, 
                                   RelativeSource={RelativeSource AncestorType={x:Type tk:DataGrid}}}"/>



Any help or ideas on what might be causing this would be greatly appreciated.

-Michael
QuestionDispose called on Window forms Dynamic controls Pin
Member 336560720-Feb-10 7:06
Member 336560720-Feb-10 7:06 
AnswerRe: Dispose called on Window forms Dynamic controls Pin
Luc Pattyn21-Feb-10 4:53
sitebuilderLuc Pattyn21-Feb-10 4:53 
Questioncreate a text blocked kind contact in hotmail Pin
rafaelht310819-Feb-10 13:09
rafaelht310819-Feb-10 13:09 
QuestionWPF Grid double clicked event Pin
sughasini18-Feb-10 23:08
sughasini18-Feb-10 23:08 
AnswerRe: WPF Grid double clicked event [add timmer] Pin
ProtoBytes19-Feb-10 4:30
ProtoBytes19-Feb-10 4:30 
QuestionHow to hide a control when its available space is too small Pin
daniel radford18-Feb-10 22:30
daniel radford18-Feb-10 22:30 
AnswerRe: How to hide a control when its available space is too small Pin
ProtoBytes19-Feb-10 4:31
ProtoBytes19-Feb-10 4:31 
QuestionSDK trouble in WPF Pin
Etienne_12318-Feb-10 6:07
Etienne_12318-Feb-10 6:07 
AnswerRe: SDK trouble in WPF Pin
Pete O'Hanlon18-Feb-10 9:51
mvePete O'Hanlon18-Feb-10 9:51 
GeneralRe: SDK trouble in WPF Pin
Etienne_12321-Feb-10 3:51
Etienne_12321-Feb-10 3:51 
QuestionText Box Validation in C#, not XAML? Pin
MattFunke18-Feb-10 4:49
MattFunke18-Feb-10 4:49 
AnswerRe: Text Box Validation in C#, not XAML? Pin
Stryder_118-Feb-10 6:17
Stryder_118-Feb-10 6:17 
GeneralRe: Text Box Validation in C#, not XAML? Pin
MattFunke18-Feb-10 7:07
MattFunke18-Feb-10 7:07 
AnswerRe: Text Box Validation in C#, not XAML? Pin
Pete O'Hanlon18-Feb-10 9:12
mvePete O'Hanlon18-Feb-10 9:12 
QuestionFacial recognition Pin
Etienne_12318-Feb-10 2:50
Etienne_12318-Feb-10 2:50 
AnswerRe: Facial recognition Pin
ProtoBytes19-Feb-10 4:36
ProtoBytes19-Feb-10 4:36 
AnswerRe: Facial recognition Pin
ProtoBytes19-Feb-10 4:46
ProtoBytes19-Feb-10 4:46 

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

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