Hi,
You cannot use "Properties.Settings.Default" in an attribute like :
C1 int User 3
C2 int User 2
C3 int User 1
You can use reflection to add attributes of type "CategoryOrder" to your SelectedObject's class, like :
Get more controls, features, updates and technical support with Xceed Toolkit Plus for WPF
You cannot use "Properties.Settings.Default" in an attribute like :
[CategoryOrder( "C1", Properties.Settings.Default.... )
But if you define your setting in the "Settings.settings" file, like: C1 int User 3
C2 int User 2
C3 int User 1
You can use reflection to add attributes of type "CategoryOrder" to your SelectedObject's class, like :
var type = typeof( MyData );
var aName = new System.Reflection.AssemblyName( "WpfApplication44" );
var ab = AppDomain.CurrentDomain.DefineDynamicAssembly( aName, AssemblyBuilderAccess.Run );
var mb = ab.DefineDynamicModule( aName.Name );
var tb = mb.DefineType( type.Name, System.Reflection.TypeAttributes.Public, type );
var attrCtorParams = new Type[] { typeof( string ), typeof( int ) };
var attrCtorInfo = typeof( CategoryOrderAttribute ).GetConstructor( attrCtorParams );
foreach( SettingsProperty prop in Properties.Settings.Default.Properties )
{
var attrBuilder = new CustomAttributeBuilder( attrCtorInfo, new object[] { prop.Name, Int32.Parse( prop.DefaultValue as string )} );
tb.SetCustomAttribute( attrBuilder );
}
var newType = tb.CreateType();
var instance = ( MyData )Activator.CreateInstance( newType );
this.DataContext = instance;
――――
Get more controls, features, updates and technical support with Xceed Toolkit Plus for WPF