protected override void OnElementChanged(ElementChangedEventArgs <GradientTextButton> e) { //base.OnElementChanged(e); if (e.NewElement != null) { button = e.NewElement; } var linear = BackgroundExtension.CreateGradientBrush(button.StartColor.ToWindows(), button.EndColor.ToWindows(), button.CenterColor.ToWindows(), button.Angle.ToWindows()); nButton = new Button { Content = button.Text, Background = new SolidColorBrush(button.BackgroundColor.ToWindows()), Foreground = linear, BorderBrush = linear, BorderThickness = new Thickness(button.BorderWidth), Style = Application.Current.Resources["ButtonRevealStyle"] as Style }; nButton.Click += (s, ev) => { button.SendClicked(); }; nButton.Holding += (s, ev) => { button.SendLongClick(); }; SetNativeControl(nButton); }
private void NButton_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { nButton.Background = BackgroundExtension.CreateGradientBrush(button.StartColor.ToWindows(), button.EndColor.ToWindows(), button.CenterColor.ToWindows(), button.Angle.ToWindows()); }
Brush CreateBackgroundUnToggle() { return(BackgroundExtension.CreateGradientBrush(button.StartColor.ToWindows(), button.EndColor.ToWindows(), button.CenterColor.ToWindows(), button.Angle.ToWindows())); }
private void Border_Loaded(object sender, RoutedEventArgs e) { border.Background = BackgroundExtension.CreateGradientBrush(frame.StartColor.ToWindows(), frame.EndColor.ToWindows(), frame.CenterColor.ToWindows(), frame.Angle.ToWindows()); border.CornerRadius = frame.CornerRadius > 0 ? new CornerRadius(frame.CornerRadius) : new CornerRadius(0); }
private void NButton_Loaded(object sender, Windows.UI.Xaml.RoutedEventArgs e) { nButton.Background = BackgroundExtension.CreateGradientBrush(button.StartColor.ToWindows(), button.EndColor.ToWindows(), button.CenterColor.ToWindows(), button.Angle.ToWindows()); if (button.Image != null && !string.IsNullOrEmpty(button.Image.File)) { RenderImage(); } }