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

Accessing ResourceDictionary from in C# programmatically - Getting Cast exception - OnIdiom

$
0
0

Hi all,

I have an issue trying to get values from my ResourceDictionary which are like this:

`

        <OnIdiom
            x:Key="SubHeader"
            x:TypeArguments="x:Double"
            Phone="18"
            Tablet="18" />`

But I want to get a hold of that in c# code, I can get it fine in XAML but struggling in code.

My code atm is is this:

FontSize = double.Parse( Application.Current.Resources["SubHeader"].ToString())

But its not working and just getting a cast exception. The Type definitely looks Double, so in theory should be able to .ToString, then parse as a double.

Any ideas would be appreciated! Need to get this in C# code not XAML, that already works fine


Viewing all articles
Browse latest Browse all 89864

Trending Articles