Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Is there a way to combine DynamicResource and IValueConverter

$
0
0

I have some styles that change at runtime, so naturally I am using XAML like this:

<Style x:Key="ThemedFrame" TargetType="Frame">
    <Setter Property="BackgroundColor" Value="{DynamicResource ThemeColorSurfacedp1}" />
    <Setter Property="BorderColor" Value="{DynamicResource ThemeColorSurfacedp24}" />
</Style>

This approach, however, requires I create a variety of resources for all possible combinations of Color elevations (and other things such as opacity).

I'd prefer to do something like this:

<Style x:Key="ThemedFrame" TargetType="Frame">
    <Setter Property="BackgroundColor" Value="{DynamicResource ThemeColorSurface, Elevation=1}" />
    <Setter Property="BorderColor" Value="{DynamicResource ThemeColorSurface, Elevation=24" />
</Style>

I've been trying to work out if it is possible to create a custom markup extension that either works the same way as DynamicResource with additional properties (as per my example), or somehow combine a DynamicResource with a Converter.

Does anyone know if this is even remotely possible?


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>