Пример #1
0
 public PatternEditorUI()
 {
     InitializeComponent();
     Editor      = Gui_.FindVisualChild <PatternEditor>((DependencyObject)Content) ?? throw new Exception("Expected a pattern editor child control");
     Cancel      = Command.Create(this, CancelInternal);
     Accept      = Command.Create(this, AcceptInternal);
     DataContext = this;
 }
Пример #2
0
        private static void HideTextBox_Changed(DependencyObject obj)
        {
            if (obj is DatePicker dp)
            {
                dp.Loaded -= OnLoaded;
                dp.Loaded += OnLoaded;
                void OnLoaded(object sender, RoutedEventArgs e)
                {
                    var tb = Gui_.FindVisualChild <DatePickerTextBox>(obj);

                    if (tb != null)
                    {
                        tb.Visibility = GetHideTextBox(obj) ? Visibility.Collapsed : Visibility.Visible;
                    }
                }
            }
        }
Пример #3
0
        private static void Watermark_Changed(DependencyObject obj)
        {
            // The water mark is the text displayed before a date has been selected
            if (obj is DatePicker dp)
            {
                dp.Loaded -= ChangeWatermark;
                dp.Loaded += ChangeWatermark;
                void ChangeWatermark(object sender, RoutedEventArgs e)
                {
                    var tb = Gui_.FindVisualChild <DatePickerTextBox>(obj);

                    if (tb != null)
                    {
                        tb.Text = GetWatermark(obj);
                    }
                }
            }
        }