Beispiel #1
0
        void LoadDynamicResources(IDynamicResources resources)
        {
            if (Resources == null)
            {
                Resources = new ResourceDictionary();
            }

            var propriedades = resources.GetType().GetRuntimeProperties();

            foreach (var prop in propriedades)
            {
                Resources.Add(prop.Name, prop.GetValue(resources));
            }
        }
        void LoadDynamicResources(IDynamicResources resources)
        {
            if (Resources == null)
            {
                Resources = new ResourceDictionary();
            }

            var properties = resources.GetType().GetRuntimeProperties();

            foreach (var prop in properties)
            {
                Resources.Add(prop.Name, prop.GetValue(resources));
            }

            if (Device.OS == TargetPlatform.iOS)
            {
                var labelStyle = new Style(typeof(Label))
                {
                    Setters =
                    {
                        new Setter {
                            Property = Label.FontFamilyProperty, Value = "HelveticaNeue"
                        }
                    }
                };
                Resources.Add(labelStyle);

                var buttonStyle = new Style(typeof(Button))
                {
                    Setters =
                    {
                        new Setter {
                            Property = Button.FontFamilyProperty, Value = "HelveticaNeue"
                        }
                    }
                };
                Resources.Add(buttonStyle);
            }
        }