protected override void OnElementChanged(ElementChangedEventArgs <Slider> e) { base.OnElementChanged(e); if (e.NewElement != null) { Windows.UI.Xaml.Style sliderStyle = (Windows.UI.Xaml.Style)Windows.UI.Xaml.Application.Current.Resources["styledSlider"]; Control.Style = sliderStyle; } }
/// <summary> /// The OnElementChanged. /// </summary> /// <param name="e">The e<see cref="ElementChangedEventArgs{Button}"/>.</param> protected override void OnElementChanged(ElementChangedEventArgs <Button> e) { base.OnElementChanged(e); // return; if (this.Control != null && this.Element != null) { Windows.UI.Xaml.Style buttonStyle = (Windows.UI.Xaml.Style)CovidASH.UWP.App.Current.Resources["ButtonStyle"]; if (buttonStyle != null) { this.Control.Style = buttonStyle; } this.RemoveBorder(); } }
public MainWindow() { InitializeComponent(); segoeFont = new Windows.UI.Xaml.Media.FontFamily("Segoe MDL2 Assets"); fontIconStyle = new Windows.UI.Xaml.Style(typeof(FontIcon)); fontIconStyle.Setters.Add(new Windows.UI.Xaml.Setter(FontIcon.FontSizeProperty, 16)); fontIconStyle.Setters.Add(new Windows.UI.Xaml.Setter(FontIcon.FontFamilyProperty, segoeFont)); headerTextBlockStyle = new Windows.UI.Xaml.Style(typeof(Windows.UI.Xaml.Controls.TextBlock)); headerTextBlockStyle.Setters.Add(new Windows.UI.Xaml.Setter(Windows.UI.Xaml.Controls.TextBlock.FontSizeProperty, 16)); headerTextBlockStyle.Setters.Add(new Windows.UI.Xaml.Setter(Windows.UI.Xaml.FrameworkElement.MarginProperty, new Windows.UI.Xaml.Thickness(5, 0, 0, 0))); contentTextBlockStyle = new Windows.UI.Xaml.Style(typeof(Windows.UI.Xaml.Controls.TextBlock)); contentTextBlockStyle.Setters.Add(new Windows.UI.Xaml.Setter(Windows.UI.Xaml.Controls.TextBlock.FontSizeProperty, 100)); contentTextBlockStyle.Setters.Add(new Windows.UI.Xaml.Setter(Windows.UI.Xaml.Controls.TextBlock.ForegroundProperty, Windows.UI.Colors.White)); contentTextBlockStyle.Setters.Add(new Windows.UI.Xaml.Setter(Windows.UI.Xaml.FrameworkElement.HorizontalAlignmentProperty, Windows.UI.Xaml.HorizontalAlignment.Center)); contentTextBlockStyle.Setters.Add(new Windows.UI.Xaml.Setter(Windows.UI.Xaml.FrameworkElement.VerticalAlignmentProperty, Windows.UI.Xaml.VerticalAlignment.Center)); }