cimbalino / Cimbalino-Phone-Toolkit

Cimbalino Windows Phone Toolkit
MIT License
78 stars 32 forks source link

Using brushes in Cimbalino appbar #40

Closed Nearga closed 10 years ago

Nearga commented 10 years ago

I have a quite large project and right now i'm sorting templates, styles, brushes, colors, etc.

I end up with idea to keep colors as they are < Color x:Key="Black100Color">#000000

and keep brushes as they used < SolidColorBrush Color="{StaticResource Black100Color}" x:Key="PressedStateWithOpacityMaskClearButtonBackgroundFillBrush"/>

In this way, i'd be able to deal with theming easily, just by setting another colors to the brushes.

Is it possible to use ColorBrush for cimbalino appbar, instead of colors? I dont think i'll customize it, but it is still good to keep things in the similar manner.

pedrolamas commented 10 years ago

The ApplicationBar will require a Color, so you can't just assign a Brush to it.

You can however create a BrushToColorConverter class and then just get the color from the specified brush on the binding!

So the binding would look something like this:

<ApplicationBarBehavior BackgroundColor="{Binding Source={StaticResource MySolidColorBrush}, Converter={StaticResource MyBrushToColorConverter}" />