Home Forums WinForms controls Xceed Grid for WinForms ExtendedProperties Reply To: ExtendedProperties

User (Old forums)
Post count: 23064

The <b>ExtendedProperties</b> property of a System.Data.DataColumn is just an object of type <b>System.Data.PropertyCollection</b>, which is just a Hashtable.

So you can just put a Hashtable in the Tag property of the Xceed.Grid.Column (or any GridElement). Here’s a class that helps using the Tag property as ExtendedProperties (warning: untested code):<code>
using System;
using System.Collections;
using Xceed.Grid;
public class ExtendedProperties
public static Hashtable Get(GridElement element)
Hashtable h = element.Tag as Hashtable;
if (h == null)
h = new Hashtable();
element.Tag = h;
return h;

public static object Get(GridElement element, object key)
return Get(element)[key];

public static void Set(GridElement element, object key, object value)
Get(element)[key] = value;
}</code>You can use it like this:<code>object prop = ExtendedProperties.Get(Grid1.Columns[Index], “key”);
ExtendedProperties.Set(Grid1.Columns[Index], “key”, “newvalue”);
Hashtable allProperties = ExtendedProperties.Get(Grid1.Columns[Index]);</code>

Imported from legacy forums. Posted by Tommy (had 153 views)