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