NotificationMessage.xaml.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using System;
  2. using System.Windows;
  3. using System.Windows.Controls;
  4. namespace MediaBrowser.UI.Controls
  5. {
  6. /// <summary>
  7. /// Interaction logic for NotificationMessage.xaml
  8. /// </summary>
  9. public partial class NotificationMessage : BaseUserControl
  10. {
  11. public NotificationMessage()
  12. {
  13. InitializeComponent();
  14. }
  15. public UIElement TextContent
  16. {
  17. set
  18. {
  19. pnlContent.Children.Clear();
  20. var textBlock = value as TextBlock;
  21. if (textBlock != null)
  22. {
  23. textBlock.SetResourceReference(TextBlock.StyleProperty, "NotificationTextStyle");
  24. }
  25. pnlContent.Children.Add(value);
  26. }
  27. }
  28. public string Text
  29. {
  30. set { TextContent = new TextBlock { Text = value }; }
  31. }
  32. private MessageBoxIcon _messageBoxImage;
  33. public MessageBoxIcon MessageBoxImage
  34. {
  35. get { return _messageBoxImage; }
  36. set
  37. {
  38. _messageBoxImage = value;
  39. OnPropertyChanged("MessageBoxImage");
  40. }
  41. }
  42. private string _caption;
  43. public string Caption
  44. {
  45. get { return _caption; }
  46. set
  47. {
  48. _caption = value;
  49. OnPropertyChanged("Caption");
  50. txtCaption.Visibility = string.IsNullOrEmpty(value) ? Visibility.Collapsed : Visibility.Visible;
  51. }
  52. }
  53. protected override void OnInitialized(EventArgs e)
  54. {
  55. base.OnInitialized(e);
  56. DataContext = this;
  57. }
  58. }
  59. }