Databinding Properties like Color/Visibility/fontSize etc

Jan 10, 2011 at 8:21 PM

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

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

if not, what it the best approach?

Jan 10, 2011 at 8: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.