Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

Xamarin.Forms Build dynamic grid how to set style from ResourceDictionary

$
0
0

Hi,

I'm building a grid from my controller code but would like to use the style I defined in my ResourceDictionary (mLabelStyle).

Does anyone know how to set this style?

Thanks!

<Application
xmlns="http://xamarin.com/schemas/2014/forms"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    x:Class="MolinaEmployee1.App">
    <Application.Resources>
        <ResourceDictionary>
            <Style x:Key="mLabelStyle" TargetType="Label">
                <Setter Property="TextColor" Value="#00A1B0" />
                <Setter Property="FontSize">
                  <Setter.Value>
...

    var label = new Label { Text = "Row 1" };
    myGrid.Children.Add(label,0,0);
    // Set the style to mLabelStyle somehow

Viewing all articles
Browse latest Browse all 77050

Trending Articles



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