We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

GridDataControl Template

Hi,

I need to style my GridDataControl, but i have some problems,

1) i need to remove the Border between the cell (even in the Header Cell) to make it appears as a list
2) When i apply my HeaderCellTemplate, if i click on the header of the column the sorting make the CellBoundValue (Currently bind to the name of the column) change to Ascending or Descending, How make the Arrow appears without change the original name of the column

Thanks in advance

Thomas M.

3 Replies

GK Ganesan K Syncfusion Team October 26, 2009 02:16 PM UTC

Hi Thomas,

Thanks for using Syncfusion products.

For #1,
You cannot have Custom theme option in our old source. Just now we implemented this feature. It’s avail to you in the RC build going to be released by today. Below is the way of applying themed visual style for the GridDataControl.

We have an interface that lets you define the themed visual style for the GridDataControl. This would be exposed as a CustomVisualStyle property
You can create the custom theme by simply creating a class which implements the IGridDataVisualStyle

We have a sample for this feature in our Dashboard in the below location.

\WPF\Grid.WPF\Samples\3.5\WindowsSamples\Grid Data Control - Advanced\Custom Visual Style Demo\CS

You just commented the border info in the sample for remove the Borders.

public CellBordersInfo HeaderCellBorders
{
get
{
return new CellBordersInfo()
{
//Top = new Pen(new SolidColorBrush(GridUtil.GetXamlConvertedValue("#FF1E2D20")), 0.3d),
//Bottom = new Pen(new SolidColorBrush(GridUtil.GetXamlConvertedValue("#FF242D27")), 0.3d),
//Right = new Pen(new SolidColorBrush(GridUtil.GetXamlConvertedValue("#FF1E2D20")), 0.3d)
};
}
}

public CellBordersInfo ValueCellBorders
{
get
{
return new CellBordersInfo()
{
//Top = new Pen(new SolidColorBrush(GridUtil.GetXamlConvertedValue("#D0DBE5")), 0.3d),
//Bottom = new Pen(new SolidColorBrush(GridUtil.GetXamlConvertedValue("#D0DBE5")), 0.3d)
};
}
}


For #2,

If you want to use the DataTemplate, then you need to override everything (Sort Icon, Filter Icon, etc..). So please use the following process to customize your "Header cell" in an easy way.

We have created the sample that uses the existing styles but it completes overrides the default style loading from our grid assembly.
You can check out the generic.xaml declared in the sample, and change it to anyway you want.

Please download the sample from the below location.
http://www.syncfusion.com/uploads/redirect.aspx?&team=support&file=GDC-SortingTriangle-1000894938.zip

Let us know if you need any more details.

Thanks
Ganesan


TM Thomas M October 27, 2009 09:44 AM UTC

Thanks for the complete answer ! i have another small question , how can i override the default selection style ?

Thanks in advance,

Thomas M.


GK Ganesan K Syncfusion Team October 27, 2009 09:59 AM UTC

Hi Thomas,

Thanks for your feedbacks.

You can override the default selection style using the below two properties in the IGridDataVisualStyle.

public Brush HighlightSelectionBackground
{
get
{
return Brushes.Yellow;
}
}

public Brush HighlightSelectionForeground
{
get
{
return Brushes.Black;
}
}

Please let us know if you need any more details.

Thanks
Ganesan

Loader.
Live Chat Icon For mobile
Up arrow icon