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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Setting the border brush on a single cell

Thread ID:

Created:

Updated:

Platform:

Replies:

96056 Aug 18,2010 12:39 PM UTC Aug 25,2010 11:13 AM UTC Silverlight 1
loading
Tags: GridControl
Administrator [Syncfusion]
Asked On August 18, 2010 12:39 PM UTC

I am trying to set the border brush on a a single cell using this code:

// This line of code runs without an exception
dataGrid.Model[RowIndex, ColumnIndex].Borders.Bottom.Brush = (SolidColorBrush)Resources["brushInvalidDataColor"];

// This line fails wiith NullReferenceException
dataGrid.Model[RowIndex, ColumnIndex].Borders.Left.Brush = (SolidColorBrush)Resources["brushInvalidDataColor"];

// This line of code runs without an exception
dataGrid.Model[RowIndex, ColumnIndex].Borders.Right.Brush = (SolidColorBrush)Resources["brushInvalidDataColor"];

// This line fails wiith NullReferenceException
dataGrid.Model[RowIndex, ColumnIndex].Borders.Top.Brush = (SolidColorBrush)Resources["brushInvalidDataColor"];

If I remove the lines causing the NullReferenceException the code runs but the border of every cell is changed - not just the one cell at RowIndex, ColumnIndex.

I want to set the border color of a single cell - how do I do that?

Muthulakshmi N [Syncfusion]
Replied On August 25, 2010 11:13 AM UTC

Hi William,

Thank you for your details.

Using the below code you can apply the border color for a single cell of Grid Control.

[C# Code]

grid.Model[4, 3].Borders.Left = new Syncfusion.Windows.Pen(new SolidColorBrush(Colors.Red), 2.0);
grid.Model[4, 3].Borders.Right = new Syncfusion.Windows.Pen(new SolidColorBrush(Colors.Red), 2.0);
grid.Model[4, 3].Borders.Top = new Syncfusion.Windows.Pen(new SolidColorBrush(Colors.Red), 2.0);
grid.Model[4, 3].Borders.Bottom = new Syncfusion.Windows.Pen(new SolidColorBrush(Colors.Red), 2.0);

Let us know if you need any details.

Thanks,
Muthulakshmi

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;