For those looking to set properties on the LabelPresenter (or other classes in the DataPresenter namespace), this code setting the Background on the LabelPresenter can be used as an example:
public MainWindow() { this.InitializeComponent(); Style style = new Style(); style.TargetType = typeof(LabelPresenter); Setter s1 = new Setter(); s1.Property = Infragistics.Windows.DataPresenter.LabelPresenter.BackgroundProperty; s1.Value = Brushes.Yellow; style.Setters.Add(s1); this.Resources.Add(typeof(LabelPresenter), style); }
Hi Francis,
Your post is very useful.I wonder if I get this code in vb.net.
(though I converted your code to vb.net, it is giving me errors. Converted vb.net code is as below.)
Dim style As Style = New Style()
style.TargetType = Type.GetType(LabelPresenter)
Dim s1 As Setter = New Setter()
s1.Property = Infragistics.Windows.DataPresenter.LabelPresenter.BackgroundProperty
s1.Value = Brushes.Yellow
style.Setters.Add(s1)
Me.Resources.Add(Type.GetType(LabelPresenter), style)
Thank you in advance..
Thanks
Barakath.