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

Xaml Resources

$
0
0

My class constructor creates and adds the resources.
I would also add resources from xaml but it seems that the xaml completely replace the object resources.

    public BasePage ()
    {

        if (this.Resources == null) this.Resources = new ResourceDictionary ();

        // Specific style
        var menubuttonstyle = new Style (typeof(Button)) { 
            Setters = { 
                new Setter { Property = Button.TextColorProperty, Value = Color.FromHex("0a4cf1")},
                new Setter { Property = Button.FontSizeProperty, Value = 27 },
                new Setter { Property = Button.BackgroundColorProperty, Value = Color.FromHex("ffffff")}
            }
        };
        this.Resources.Add ("MenuButton",menubuttonstyle);


    }

The Xaml:

<local:BasePage.Resources>
    <ResourceDictionary>
        <local:InverterConverter x:Key="inverterConverter" />
    </ResourceDictionary>
</local:BasePage.Resources>

    <Button Text="{Binding btNuovoOrdine_Text}" Grid.Row="0" Grid.Column="0" Style="{StaticResource MenuButton}"  Clicked="Funzione1Clicked"/>

The Style menubutton has been removed.

Is there a way to do it?
Thanks.


Viewing all articles
Browse latest Browse all 58056

Trending Articles



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