12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Media;
- using Bolt.Toolkit.Wpf.Data.Enum;
- namespace VirgoUI.Client.Controls.Parts
- {
- /// <summary>
- /// Door.xaml 的交互逻辑
- /// </summary>
- public partial class Door : UserControl
- {
- public DoorState State
- {
- get { return (DoorState)GetValue(StateProperty); }
- set { SetValue(StateProperty, value); }
- }
- // Using a DependencyProperty as the backing store for Status. This enables animation, styling, binding, etc...
- public static readonly DependencyProperty StateProperty =
- DependencyProperty.Register("State", typeof(DoorState), typeof(Door), new FrameworkPropertyMetadata(DoorState.Unknown, FrameworkPropertyMetadataOptions.AffectsRender));
- public Door()
- {
- InitializeComponent();
- }
- protected override void OnRender(DrawingContext drawingContext)
- {
- base.OnRender(drawingContext);
- switch (State)
- {
- case DoorState.Open:
- //border.BorderThickness = new Thickness(0);
- image.Visibility = Visibility.Hidden;
- break;
- case DoorState.Close:
- image.Visibility = Visibility.Visible;
- //border.BorderThickness = new Thickness(0);
- break;
- case DoorState.Unknown:
- image.Visibility = Visibility.Visible;
- //border.BorderThickness = new Thickness(2);
- break;
- default:
- break;
- }
- }
- }
- }
|