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

How do I properly do an Application level ResourceDictionary?

$
0
0

I have tried a bunch of different configurations, but all of them either give me errors or do nothing. This code does nothing. All of the ContentPage classes have the same default, unchanged color after I put this code into the application. I copied the code from the Resource Dictionaries page and changed the Application tag to match the Application tag in this file except for x:Class, but the code doesn't change the app at all.

App.xaml

<Application xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                 xmlns:custom="clr-namespace:ResourceLibrary;assembly=ResourceLibrary" 
                x:Class="anesthesiaconsiderationsAndroid.App">
    <Application.Resources>
        <ResourceDictionary>
            <Color x:Key="PageBackgroundColor">Yellow</Color>
            <Color x:Key="HeadingTextColor">Black</Color>
            <Color x:Key="NormalTextColor">Blue</Color>
            <Style x:Key="LabelPageHeadingStyle" TargetType="Label">
                <Setter Property="FontAttributes" Value="Bold" />
                <Setter Property="HorizontalOptions" Value="Center" />
                <Setter Property="TextColor" Value="{StaticResource HeadingTextColor}" />
            </Style>
        </ResourceDictionary>
    </Application.Resources>
</Application>

App.xaml.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;

namespace anesthesiaconsiderationsAndroid
{
    public partial class App : Application
   {
        public App()
        {
            InitializeComponent();
        }
    }
}

Viewing all articles
Browse latest Browse all 89864

Latest Images

Trending Articles



Latest Images

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