Databinding Properties like Color/Visibility/fontSize etc

Jan 10, 2011 at 9:21 PM

Hi
Is it possible to databind directly properties like FontSize, Foreground (brush), visibility etc.

e.g.
View: <TextBlock Foreground="{Binding MyColor}" />
ViewModel: public Brush MyColor{ get { return Brushes.Red; }

if not, what it the best approach?

Coordinator
Jan 10, 2011 at 9:30 PM

Yes. You can always use explicit databinding. Additionally, if the convention system sees that you have a databinding expression already, it won't overwrite it.