public MainPage() { this.InitializeComponent(); IEnumerable <PropertyInfo> propertyinfos = typeof(Colors).GetTypeInfo().DeclaredProperties; foreach (PropertyInfo pInfo in propertyinfos) { ColorItemCtrl ctrl = new ColorItemCtrl(pInfo.Name, (Color)pInfo.GetValue(null)); wrapGrid.Children.Add(ctrl); } }
public MainPage() { this.InitializeComponent(); IEnumerable <PropertyInfo> properties = typeof(Colors).GetTypeInfo().DeclaredProperties; foreach (PropertyInfo property in properties) { Color clr = (Color)property.GetValue(null); ColorItemCtrl clrItem = new ColorItemCtrl(property.Name, clr); MainStackPanel.Children.Add(clrItem); } }