This is a migrated thread and some comments may be shown as answers.

[Solved] How to remove space for custom header style

0 Answers 110 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
sachin
Top achievements
Rank 1
sachin asked on 26 Mar 2009, 02:30 PM

 

 

Hi
I am using following resource Style for setting it to Grid Header.
as below

 

dtextcol.HeaderStyle = Resources[

"ColumnHeaderStyle"] as Style;

 

 

I also have set width of each column to  DataGridLength.SizeToCells;

 

But still I am getting some spaces in header part.

Can you please help me in removing it.

Below is my static Resource Style.

<

 

Style x:Key="ColumnHeaderStyle" TargetType="dataprimitives:DataGridColumnHeader">

 

 

 

<Setter Property="Template" >

 

 

 

<Setter.Value>

 

 

 

<ControlTemplate TargetType="dataprimitives:DataGridColumnHeader">

 

 

 

<StackPanel Orientation="Vertical">

 

 

 

<!--<DataTemplate>-->

 

 

 

<TextBox x:Name="txt" Text="" Tag="{TemplateBinding Content}" TextChanged="TextBox_TextChanged" Style="{StaticResource SearchTextBoxStyle}"/>

 

 

 

<Grid x:Name="Root">

 

 

 

<Grid.RowDefinitions>

 

 

 

<RowDefinition Height="*" />

 

 

 

<RowDefinition Height="*" />

 

 

 

<RowDefinition Height="*" />

 

 

 

</Grid.RowDefinitions>

 

 

 

<Grid.ColumnDefinitions>

 

 

 

<ColumnDefinition Width="*" />

 

 

 

<ColumnDefinition Width="*" />

 

 

 

<ColumnDefinition Width="Auto" />

 

 

 

</Grid.ColumnDefinitions>

 

 

 

<Rectangle x:Name="BackgroundRectangle" Stretch="Fill" Grid.ColumnSpan="2" Grid.RowSpan="2">

 

 

 

<Rectangle.Fill>

 

 

 

<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">

 

 

 

<GradientStop Color="#FFFFFFFF"/>

 

 

 

<GradientStop Color="#FFFFC18F" Offset="1"/>

 

 

 

</LinearGradientBrush>

 

 

 

</Rectangle.Fill>

 

 

 

</Rectangle>

 

 

 

<Rectangle x:Name="BackgroundGradient" Stretch="Fill" Grid.ColumnSpan="2" Grid.RowSpan="2">

 

 

 

<Rectangle.Fill>

 

 

 

<SolidColorBrush Color="{TemplateBinding Background}" />

 

 

 

</Rectangle.Fill>

 

 

 

</Rectangle>

 

 

 

<ContentPresenter

 

 

Grid.RowSpan="2"

 

 

Content="{TemplateBinding Content}"

 

 

Cursor="{TemplateBinding Cursor}"

 

 

HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"

 

 

VerticalAlignment="{TemplateBinding VerticalContentAlignment}"

 

 

Margin="{TemplateBinding Padding}"/>

 

 

 

<Rectangle x:Name="VerticalSeparator" Grid.RowSpan="2" Grid.Column="2" Width="1" VerticalAlignment="Stretch" Fill="{TemplateBinding SeparatorBrush}" Visibility="{TemplateBinding SeparatorVisibility}" />

 

 

 

<Path Grid.RowSpan="2" x:Name="SortIcon" RenderTransformOrigin=".5,.5" HorizontalAlignment="Left" VerticalAlignment="Center" Opacity="0" Grid.Column="1" Stretch="Uniform" Width="8" Data="F1 M -5.215,6.099L 5.215,6.099L 0,0L -5.215,6.099 Z " Fill="#FF444444">

 

 

 

<Path.RenderTransform>

 

 

 

<TransformGroup>

 

 

 

<ScaleTransform x:Name="SortIconTransform" ScaleX=".9" ScaleY=".9" />

 

 

 

</TransformGroup>

 

 

 

</Path.RenderTransform>

 

 

 

</Path>

 

 

 

</Grid>

 

 

 

</StackPanel>

 

 

 

</ControlTemplate>

 

 

 

</Setter.Value>

 

 

 

</Setter>

 

 

 

</Style>


Regards,
sachin

 

Tags
GridView
Asked by
sachin
Top achievements
Rank 1
Share this question
or