Hello,
Does anybody know the best way to conserve the vertical and/or horizontal lines used in the Themes such as "Aero" and "Office2k7Black" when applying a custom template to each CellValuePresenter?
The problem is when you provide your own template for each CellValuePresenter you lose the grid lines. I have tried drawing my own lines with the Line Class, but with varied results :
horizontalLine = new Line(); horizontalLine.Stroke = Brushes.SlateGray; horizontalLine.StrokeThickness = 0.1; horizontalLine.Stretch = Stretch.Fill; horizontalLine.X1 = 0; horizontalLine.X2 = 1; horizontalLine.Y1 = 0; horizontalLine.Y2 = 0;
And then I've added this element to the bottom of a Stack Panel with the main content at the top. This works for some rows and not for others, it's a completely random occurrence, depending on how many rows there are in the result set. If you set the StrokeThickness to 0.2 then you see all the horizontal lines, but you then have a mismatch of thicknesses, some fat and some thin!
Any ideas appreciated,
Jamie
You should see better results with a Border element, which is what the CellValuePresenter template uses to achieve that line. For example:
<igDP:Field Name="Name"> <igDP:Field.Settings> <igDP:FieldSettings> <igDP:FieldSettings.CellValuePresenterStyle> <Style TargetType="{x:Type igDP:CellValuePresenter}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type igDP:CellValuePresenter}"> <Border BorderBrush="Blue" BorderThickness="0,0,0,1"> <SomeElementInTheCell /> </Border> </ControlTemplate> </Setter.Value> </Setter> </Style> </igDP:FieldSettings.CellValuePresenterStyle> </igDP:FieldSettings> </igDP:Field.Settings></igDP:Field>