Пример #1
0
        protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
        {
            base.OnApplyTemplate(e);

            _closebutton        = this.GetControl <Button>(e, "PART_ButtonClose");
            _closebutton.Click += (s, e) =>
            {
                this.Close();
            };
        }
        void AssociatedObject_TemplateApplied(object sender, TemplateAppliedEventArgs args)
        {
            this.AssociatedObject.GanttGrid.ReadOnly = true;

            // Customizing the header text of the Grid.
            this.AssociatedObject.GanttGrid.Columns[0].HeaderText = "Resource Name";
            this.AssociatedObject.GanttGrid.Columns[1].HeaderText = "Start Date";
            this.AssociatedObject.GanttGrid.Columns[2].HeaderText = "Finish Date";
            this.AssociatedObject.ScrollGanttChartTo(new DateTime(2012, 01, 06));
        }
Пример #3
0
        /// <inheritdoc/>
        protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
        {
            if (_popup != null)
            {
                _popup.Opened -= PopupOpened;
            }

            _popup         = e.NameScope.Get <Popup>("PART_Popup");
            _popup.Opened += PopupOpened;
        }
Пример #4
0
        protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
        {
            _presenter        = e.NameScope.Get <TextPresenter>("PART_TextPresenter");
            _presenter.Cursor = new Cursor(StandardCursorType.Ibeam);

            if (IsFocused)
            {
                _presenter.ShowCaret();
            }
        }
Пример #5
0
        void SetupSide(string name, StandardCursorType cursor, WindowEdge edge, ref TemplateAppliedEventArgs e)
        {
            var control = e.NameScope.Get <Control>(name);

            control.Cursor          = new Cursor(cursor);
            control.PointerPressed += (object sender, PointerPressedEventArgs ep) =>
            {
                ((Window)this.GetVisualRoot()).PlatformImpl?.BeginResizeDrag(edge, ep);
            };
        }
Пример #6
0
        private async void ColorPickerTemplateApplied(object?sender, TemplateAppliedEventArgs e)
        {
            await System.Threading.Tasks.Task.Yield();

            spectrumRectangle = FindVisualChildByName(ColorPicker, "PART_SpectrumRectangle") as Rectangle;

            if (spectrumRectangle != null)
            {
                spectrumRectangle.GetPropertyChangedObservable(Shape.FillProperty).AddClassHandler <Rectangle>(SpectrumRectangleFillChanged);
            }

            colorSpectrumInputTarget = FindVisualChildByName(ColorPicker, "PART_InputTarget") as Control;

            if (colorSpectrumInputTarget != null)
            {
                UpdateHeightFromInputTarget();
                colorSpectrumInputTarget.GetPropertyChangedObservable(Control.BoundsProperty).AddClassHandler <Control>(ColorSpectrumImageSizeChanged);
            }

            var comboBox = FindVisualChildByName(ColorPicker, "PART_ColorRepresentationComboBox") as ComboBox;

            previousColorRectangle = FindVisualChildByName(ColorPicker, "PART_PreviousColorRectangle") as Rectangle;

            if (previousColorRectangle != null)
            {
                previousColorRectangle.GetPropertyChangedObservable(Shape.FillProperty).AddClassHandler <Rectangle>(PreviousColorRectangleFillChanged);
            }

            selectionEllipsePanel = FindVisualChildByName(ColorPicker, "PART_SelectionEllipsePanel") as Panel;

            if (selectionEllipsePanel != null)
            {
                previousColorRectangle.GetPropertyChangedObservable(Canvas.LeftProperty).AddClassHandler <Panel>(SelectionEllipsePositionChanged);
                previousColorRectangle.GetPropertyChangedObservable(Canvas.TopProperty).AddClassHandler <Panel>(SelectionEllipsePositionChanged);

                UpdateSelectionEllipsePosition();
            }

            selectionEllipse = FindVisualChildByName(ColorPicker, "PART_SelectionEllipse") as Ellipse;

            if (selectionEllipse != null)
            {
                selectionEllipse.GetPropertyChangedObservable(Ellipse.StrokeProperty).AddClassHandler <Ellipse>(SelectionEllipseStrokeChanged);

                UpdateSelectionEllipseColor();

                colorNameToolTip = ToolTip.GetTip(selectionEllipse) as ToolTip;

                if (colorNameToolTip != null)
                {
                    colorNameToolTip.GetPropertyChangedObservable(ToolTip.ContentProperty).AddClassHandler <ToolTip>(ColorNameToolTipContentChanged);
                    UpdateSelectedColorName();
                }
            }
        }
Пример #7
0
        protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
        {
            base.OnApplyTemplate(e);

            this.R_ = this.GetControl <TextBox>(e, "PART_RText");
            this.G_ = this.GetControl <TextBox>(e, "PART_GText");
            this.B_ = this.GetControl <TextBox>(e, "PART_BText");
            this.A_ = this.GetControl <TextBox>(e, "PART_AText");

            this.PropertyChanged += RGBIndicator_PropertyChanged;
        }
        protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
        {
            base.OnTemplateApplied(e);

            var carousel = e.NameScope.Find <Carousel>("PART_Carousel");

            if (carousel != null)
            {
                carousel.MemberSelector = ContentSelector;
            }
        }
Пример #9
0
        protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
        {
            base.OnApplyTemplate(e);

            _thumb = e.NameScope.Find <Thumb>("thumb");

            if (ToolTip.GetTip(_thumb) is ToolTip toolTip)
            {
                toolTip.Content = GetToolTipString();
            }
        }
Пример #10
0
        protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
        {
            base.OnTemplateApplied(e);

            if (e.NameScope.Find("PART_CP") is ContentPresenter contentPresenter)
            {
                contentPresenter.Content = TextView;

                SearchPanel.Install(this);
            }
        }
Пример #11
0
        protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
        {
            base.OnApplyTemplate(e);
            path             = e.NameScope.Get <Path>(PartPath);
            content          = e.NameScope.Get <ContentPresenter>(PartContent);
            contentContainer = e.NameScope.Get <Panel>(PartContentContainer);
            horizontalLine   = e.NameScope.Find <Line>(PartHorizontalLine);
            verticalLine     = e.NameScope.Find <Line>(PartVerticalLine);

            UpdatePositionAndBorder();
        }
Пример #12
0
        protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
        {
            base.OnApplyTemplate(e);

            _parentTagBox = Parent as TagsBox;

            _subscription?.Dispose();

            var deleteButton = e.NameScope.Find <Button>("PART_DeleteButton");

            if (deleteButton is { })
Пример #13
0
        protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
        {
            var thisHandle = PlatformImpl.Handle.Handle;

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                NativeMethodsWindows.FocusThisWindow(thisHandle);
            }

            base.OnApplyTemplate(e);
        }
        protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
        {
            base.OnTemplateApplied(e);

            _popup = e.NameScope.Find <Popup>("PART_Popup");

            _popup.PlacementTarget = PlacementTarget;
            _popup.PlacementMode   = PlacementMode.Right;

            _popup.Closed += _popup_Closed;
        }
Пример #15
0
        protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
        {
            base.OnApplyTemplate(e);

            xaml_edit = this.GetControl <TextEditor>(e, "editor_xaml");
            c_edit    = this.GetControl <TextEditor>(e, "editor_csharp");

            c_edit.TextArea.IndentationStrategy = new CSharpIndentationStrategy();

            xaml_edit.Text = XAMLText;
            c_edit.Text    = CSharpText;
        }
Пример #16
0
        protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
        {
            base.OnTemplateApplied(e);

            _viewHost = e.NameScope.Find <Control>("PART_Presenter");

            _popup = e.NameScope.Find <Popup>("PART_Popup");

            _popup.PlacementMode = PlacementMode.Pointer;

            _popup.HorizontalOffset = 0;
        }
Пример #17
0
        protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
        {
            base.OnApplyTemplate(e);

            MiniButton        = this.GetControl <MaterialButton>(e, "PART_MiniButton");
            MiniButton.Click += (s, _) =>
            {
                var e = new RoutedEventArgs(MiniButtonClickEvent);
                RaiseEvent(e);
                e.Handled = true;
            };
        }
Пример #18
0
        /// <summary>
        /// gets the controls from the style
        /// </summary>
        /// <param name="e"></param>
        protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
        {
            this.flyoutRoot = e.NameScope.Find <Border>("PART_Root");
            if (this.flyoutRoot == null)
            {
                return;
            }

            this.flyoutHeader = e.NameScope.Find <MetroThumbContentControl>("PART_Header");
            this.flyoutHeader?.ApplyTemplate();
            this.flyoutContent = e.NameScope.Find <ContentPresenter>("PART_Content");

            var thumbContentControl = this.flyoutHeader as IMetroThumb;

            if (thumbContentControl != null)
            {
                thumbContentControl.DragStarted   -= this.WindowTitleThumbOnDragStarted;
                thumbContentControl.DragCompleted -= this.WindowTitleThumbOnDragCompleted;
                //thumbContentControl.PreviewMouseLeftButtonUp -= this.WindowTitleThumbOnPreviewMouseLeftButtonUp;
                thumbContentControl.DragDelta       -= this.WindowTitleThumbMoveOnDragDelta;
                thumbContentControl.DoubleTapped    -= this.WindowTitleThumbChangeWindowStateOnMouseDoubleClick;
                thumbContentControl.PointerReleased -= this.WindowTitleThumbSystemMenuOnMouseRightButtonUp;

                var flyoutsControl = this.TryFindParent <FlyoutsControl>();
                if (flyoutsControl != null)
                {
                    thumbContentControl.DragStarted   += this.WindowTitleThumbOnDragStarted;
                    thumbContentControl.DragCompleted += this.WindowTitleThumbOnDragCompleted;
                    //thumbContentControl.PreviewMouseLeftButtonUp += this.WindowTitleThumbOnPreviewMouseLeftButtonUp;
                    thumbContentControl.DragDelta       += this.WindowTitleThumbMoveOnDragDelta;
                    thumbContentControl.DoubleTapped    += this.WindowTitleThumbChangeWindowStateOnMouseDoubleClick;
                    thumbContentControl.PointerReleased += this.WindowTitleThumbSystemMenuOnMouseRightButtonUp;
                }
            }

            //this.hideStoryboard = this.GetTemplateChild("HideStoryboard") as Storyboard;
            //this.hideFrame = e.NameScope.Find<KeyFrameExt>("hideFrame") as KeyFrameExt;
            //this.hideFrameY = this.GetTemplateChild("hideFrameY") as SplineDoubleKeyFrame;
            //this.showFrame = this.GetTemplateChild("showFrame") as SplineDoubleKeyFrame;
            //this.showFrameY = this.GetTemplateChild("showFrameY") as SplineDoubleKeyFrame;
            //this.fadeOutFrame = this.GetTemplateChild("fadeOutFrame") as SplineDoubleKeyFrame;

            //if (this.hideFrame == null || this.showFrame == null || this.hideFrameY == null || this.showFrameY == null || this.fadeOutFrame == null)
            //{
            //    return;
            //}

            base.OnTemplateApplied(e);
            UpdateOpacityChange();
            UpdateFlyoutTheme();
            this.ApplyAnimation(this.Position, this.AnimateOpacity);
        }
Пример #19
0
        /// <summary>
        /// gets some controls from the style
        /// </summary>
        /// <param name="e"></param>
        protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
        {
            base.OnTemplateApplied(e);
            _imageCtl = e.NameScope.Find <Image>(ImageCtrlName);
            Button _button = e.NameScope.Find <Button>("ListBoxItemButton");

            _button.Tapped += (o, f) =>
            {
                this.IsSelected = true;
            };

            UpdateMenuIcon();
        }
Пример #20
0
 /// <summary>
 /// Handles the <see cref="E:ApplyTemplate" /> event.
 /// </summary>
 /// <param name="e">The <see cref="TemplateAppliedEventArgs" /> instance containing the event data.</param>
 protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
 {
     base.OnApplyTemplate(e);
     if (ContextMenu != null)
     {
         if (registeredEvent)
         {
             ContextMenu.ContextMenuOpening -= ContextMenuOpening;
         }
         ContextMenu.ContextMenuOpening += ContextMenuOpening;
         registeredEvent = true;
     }
 }
Пример #21
0
        protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
        {
            base.OnApplyTemplate(e);

            AdderButton = this.GetControl <Button>(e, "PART_AdderButton");

            AdderButton.Click += AdderButtonClicked;

            b_ = this.GetControl <Border>(e, "PART_InternalBorder");
            g_ = this.GetControl <Grid>(e, "PART_InternalGrid");

            PropertyChanged += AuraTabView_PropertyChanged;
        }
Пример #22
0
        protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
        {
            base.OnApplyTemplate(e);

            _captionButtons = e.NameScope.Get <CaptionButtons>("PART_CaptionButtons");

            if (_hostWindow != null)
            {
                _captionButtons.Attach(_hostWindow);
            }

            UpdateSize();
        }
Пример #23
0
        protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
        {
            base.OnApplyTemplate(e);
            var buttons = this.GetVisualDescendants().OfType <Button>().ToList();

            minimizeButton = buttons.FirstOrDefault(x => x.Name == "MinimizeButton");
            maximizeButton = buttons.FirstOrDefault(x => x.Name == "MaximizeButton");
            restoreButton  = buttons.FirstOrDefault(x => x.Name == "RestoreButton");
            closeButton    = buttons.FirstOrDefault(x => x.Name == "CloseButton");
            SystemButtonsProperty.Changed.AddClassHandler <LightWindowBase>((o, e) => this.HandleSystemButtons());
            WindowStateProperty.Changed.AddClassHandler <LightWindowBase>((o, e) => this.HandleSystemButtons());
            HandleSystemButtons();
        }
Пример #24
0
        private void TreeViewItemTemplateApplied(object sender, TemplateAppliedEventArgs e)
        {
            var item            = (TreeViewItem)sender;
            var headerPresenter = item.HeaderPresenter;

            headerPresenter.ApplyTemplate();

            var header = headerPresenter.Child;

            header.PointerEnter  += AddAdorner;
            header.PointerLeave  += RemoveAdorner;
            item.TemplateApplied -= TreeViewItemTemplateApplied;
        }
Пример #25
0
        /// <summary>
        /// gets the border from the style
        /// </summary>
        /// <param name="e"></param>
        protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
        {
            var iconBorder = e.NameScope.Find <Border>("PART_SearchIconBorder");

            if (iconBorder != null)
            {
                iconBorder.PointerPressed  += IconBorderMouseLeftButtonDown;
                iconBorder.PointerReleased += IconBorderMouseLeftButtonUp;
                iconBorder.PointerLeave    += IconBorderMouseLeave;
                ;
            }
            base.OnTemplateApplied(e);
        }
Пример #26
0
        protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
        {
            base.OnApplyTemplate(e);

            _cursorEllipse   = e.NameScope.Find <Ellipse>("PART_CursorEllipse");
            _spectrumEllipse = e.NameScope.Find <Ellipse>("PART_SpectrumEllipse");

            PointerPressed  += ColorWheel_PointerPressed;
            PointerMoved    += ColorWheel_PointerMoved;
            PointerReleased += ColorWheel_PointerReleased;

            SetCursor(_colorManager.CurrentColor);
        }
Пример #27
0
 private void NumericUpDown_OnTemplateApplied(object sender, TemplateAppliedEventArgs e)
 {
     // We want to focus the TextBox of the NumericUpDown. To do so we search for this control when the template
     // is applied, but we postpone the action until the control is actually loaded.
     if (e.NameScope.Find <TextBox>("PART_TextBox") is {} textBox)
     {
         Dispatcher.UIThread.InvokeAsync(() =>
         {
             textBox.Focus();
             textBox.SelectAll();
         }, DispatcherPriority.Loaded);
     }
 }
Пример #28
0
        protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
        {
            base.OnApplyTemplate(e);

            //gets slider
            AlphaSlider = this.GetControl <Slider>(e, "PART_AlphaSlider");

            HexTextBox = this.GetControl <TextBox>(e, "PART_HexTextBox");

            ValueSaturationPicker = this.GetControl <HuePickerBase>(e, "PART_SaturationValuePicker");

            HueSlider = this.GetControl <RadialColorSlider>(e, "PART_HueSlider");

            SelectNewColor(PreviewColor, UpdatedColorReason.ColorPickerInitializated);

            RadialColorSlider.ValueProperty.Changed.AddClassHandler <RadialColorSlider>((x, e) =>
            {
                if (e.Sender == HueSlider)
                {
                    SelectNewColor(new HSV(HueSlider.Value, S, V).ToColor(), UpdatedColorReason.HueChanged);
                }
            });
            HuePickerBase.ValueColorProperty.Changed.AddClassHandler <HuePickerBase>((x, e) =>
            {
                if (e.Sender == ValueSaturationPicker)
                {
                    SelectNewColor(new HSV(H, (byte)ValueSaturationPicker.Saturation, (byte)ValueSaturationPicker.ValueColor).ToColor(), UpdatedColorReason.ValueAndSaturationChanged);
                }
            });
            Slider.ValueProperty.Changed.AddClassHandler <Slider>((x, e) =>
            {
                if (e.Sender == AlphaSlider)
                {
                    SelectNewColor(Color.FromArgb((byte)AlphaSlider.Value, (byte)R, (byte)G, (byte)B), UpdatedColorReason.AChanged);
                }
            });

            HexTextBox.TextInput += delegate
            {
                var isValid = Color.TryParse(HexTextBox.Text, out Color color);
                if (isValid)
                {
                    SelectNewColor(color, UpdatedColorReason.HexChanged);
                }
                else
                {
                    HexTextBox.Text = SelectedColor.ToString();
                }
            };
        }
Пример #29
0
        /// <summary>
        /// Builds the visual tree for the LayoutTransformerControl when a new
        /// template is applied.
        /// </summary>
        protected override void OnTemplateApplied(TemplateAppliedEventArgs e)
        {
            base.OnTemplateApplied(e);

            _matrixTransform = new MatrixTransform();

            if (null != TransformRoot)
            {
                TransformRoot.RenderTransform = _matrixTransform;
                TransformRoot.TransformOrigin = new RelativePoint(0, 0, RelativeUnit.Absolute);
            }

            ApplyLayoutTransform();
        }
Пример #30
0
        protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
        {
            base.OnApplyTemplate(e);

            CloseButton = this.GetControl <Button>(e, "PART_CloseButton");
            if (this.IsClosable != false)
            {
                CloseButton.Click += CloseButton_Click;
            }
            else
            {
                CloseButton.IsVisible = false;
            }
        }