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

Updating column appearance

I have created a DateTimeCellAppearance class which is a subclass GridTableCellAppearance. I set the Appearance property of one of my GridColumnDesriptor objects to be an instance of this DateTimeCellAppearance object.

Within the DateTimeCellAppearance class, I'm changing the AnyrecordFieldCell.Format property every so often to vary from "MM/dd/yyyy" to "dd/MM/yyyy". I would like for these changes to be reflected in my grid, but for some reason, they are not reflected.

Any suggestions on how I can get this to work?

Thanks!

ecastill

3 Replies

JN Jayakumar Natarajan Syncfusion Team October 20, 2006 10:58 PM UTC

Hi Ecastill,
I am not sure whether it would work. We are trying to setup a sample to see the behavior here. If you could send us your sample, it would be helpful.

Thanks,
Jay


EC ecastill October 22, 2006 06:59 PM UTC

Attached is an example. Modifying the appearance internally doesn't seem to work, but re-assigning the appearance of the column seems to work.

Modifying the appearance internally then notifying the parent grid of change would be ideal. I've tried calling Owner.RaiseAppearanceChanged from inside my custom appearance, but this doesn't work. Any suggestions?

Thanks,

Eric

GridColumnAppearanceTest.zip


JN Jayakumar Natarajan Syncfusion Team October 23, 2006 08:07 PM UTC

Hi Eric,
It is not possible to assign an instance of a Appearance object to a column descriptor or any other engine object. When you call the Appearance setter it will just copy the values from the object.

This is the Appearance getter/setter for reference:


public GridTableCellAppearance Appearance
{
get
{
if (appearance == null)
{
appearance = new GridTableCellAppearance(this);
appearance.PropertyFilter = GridTableCellAppearance.ColumnDescriptorPropertyFilter;
}
return appearance;
}
set
{
if (value != null)
Appearance.InitializeFrom(value);
else
ResetAppearance();
}
}


Therefore modifying your appearance object internally will have no effect on the columns that is was previously assigned to. Every time you make a change to your appearance object you will have to reapply them to the columns you applied it.

You could try to define a base style instead and register it with GridGroupingControl.BaseStyles. Then your column can specify that “basestyle” to inherit settings from and changes made to the base style will be reflected in the columns.

This is description of GridGroupingControl.BaseStyles



///

/// Maintains a collection of base styles. Users can add BaseStyles to the engine (also in design-time) and

/// then inherit style settings through the GridStyleInfo.BaseStyle property in

/// property of .

///


public GridTableBaseStyleCollection BaseStyles


Thanks,
Jay

Loader.
Live Chat Icon For mobile
Up arrow icon