public CMessageBox(string message, string caption, CColor.Theme theme, CImage.ImageType image, CMessageBoxButton _buttonType) { InitializeComponent(); this.SizeToContent = SizeToContent.Height; SystemSounds.Beep.Play(); //set image string imagePath = CImage.GetImagePath(image); ImageBrush imgBrush = new ImageBrush { ImageSource = new BitmapImage(new Uri(imagePath, UriKind.Absolute)) }; RCT_image.Fill = imgBrush; //set text / caption TBL_message.Text = message; windowheader.C_HeaderText = caption; //set theme in border and header background GRD_border.Background = CColor.GetColorBrush(theme); windowheader.C_BackgroundTheme = theme; //enable button by given buttontype buttonType = _buttonType; switch (buttonType) { case CMessageBoxButton.OK: B_3.Visibility = Visibility.Hidden; B_2.Visibility = Visibility.Hidden; B_1.Content = "OK"; break; case CMessageBoxButton.OK_Cancel: B_3.Visibility = Visibility.Hidden; B_2.Content = "OK"; B_1.Content = "Abbrechen"; break; case CMessageBoxButton.Yes_No: B_3.Visibility = Visibility.Hidden; B_2.Content = "Ja"; B_1.Content = "Nein"; break; case CMessageBoxButton.Yes_No_Cancel: B_3.Content = "Ja"; B_2.Content = "Nein"; B_1.Content = "Abbrechen"; break; default: break; } B_1.Focus(); }
private static void ButtonTypeValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var control = (CIconButton)d; CImage.ImageType newType = (CImage.ImageType)e.NewValue; string path = CImage.GetImagePath(newType); control.Content = new Image { Source = new BitmapImage(new Uri(path, UriKind.Absolute)), VerticalAlignment = VerticalAlignment.Center, Stretch = Stretch.Fill }; }
private static void ButtonTypeValueChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { var control = (CIconTextHorizontalButton)d; CImage.ImageType newType = (CImage.ImageType)e.NewValue; string imagePath = CImage.GetImagePath(newType); Image imgBrush = new Image { Source = new BitmapImage(new Uri(imagePath, UriKind.Absolute)) }; control.Content = imgBrush; }