Here i am creating ObservableCollection with object type as MyBrush.
public class ColorItemList: ObservableCollection
{
public
{
Type type = typeof( Brushes );
foreach( PropertyInfo propertyInfo in type.GetProperties( BindingFlags.Public BindingFlags.Static ) )
{
if( propertyInfo.PropertyType == typeof( SolidColorBrush ) )
Add( new MyBrush( propertyInfo.Name, ( SolidColorBrush )propertyInfo.GetValue( null, null ) ) );
}
}
}
MyBrush.CS class should be like this.
public class MyBrush
{
private string m_name;
private SolidColorBrush m_brush;
public string Name
{
get
{
return m_name;
}
set
{ m_name = value;
}
}
public SolidColorBrush Brush
{
get
{
return m_brush;
}
}
public MyBrush(string name, SolidColorBrush brush )
{
m_name = name;
m_brush = brush;
Color color = brush.Color;
}
}
Now you can get System brushes list using our IEnumerable class MyBrushList.
I hope you may got idea. if not Please don't hesitate to post your comments here.
Hello. This post is likeable, and your blog is very interesting, congratulations :-). I will add in my blogroll =). If possible gives a last there on my site, it is about the CresceNet, I hope you enjoy. The address is http://www.provedorcrescenet.com . A hug.
ReplyDeleteHi,
ReplyDeleteIn the post I see class ColorItemList and constructor MyBrushList() for this class. I guess the code needs to be changed. Just a general feedback.
Hi,
ReplyDeleteThanks for brought up the mistake into my attention.