예제 #1
0
        public TwoLineTextBlockControl()
        {
            _fontOptions                  = new FontOptions();
            _fontObserverDisposer         = _fontOptions.Observe(this);
            _fontOptions.PropertyChanged += FontOptionsOnPropertyChanged;
            _textMeasure                  = TextMeasureHelper.GetTextMeasure(new FontOptionsStruct(_fontOptions));

            _panel = new TwoLineTextBlockPanel(CreateTextBlock(), CreateTextBlock());

            ChildInternal = _panel;
        }
예제 #2
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            this.parent = Helpers.ParentFinder.FindParent <Window>(this);
            if (this.parent == null)
            {
                return;
            }

            this.parent.StateChanged += this.OnParentWindowStateChanged;
            this.Title = this.parent.Title;
            var textSize = TextMeasureHelper.MeasureText(this.titlebarTextblock);

            this.titlebarTextBackground.Width  = textSize.Width + 5;
            this.titlebarTextBackground.Height = textSize.Height;
            this.Icon = this.parent.Icon;

            var customWindow = this.parent as CustomWindow;

            if (customWindow != null && customWindow.IsToolWindow)
            {
                this.ShowMinimizeButton = false;
                this.ShowRestoreButton  = false;
            }

            switch (this.parent.ResizeMode)
            {
            case ResizeMode.CanMinimize:
                this.ShowMinimizeButton  = this.ShowMinimizeButton && true;
                this.ShowRestoreButton   = this.ShowRestoreButton && true;
                this.EnableRestoreButton = this.EnableRestoreButton && false;
                break;

            case ResizeMode.CanResize:
                this.ShowMinimizeButton  = this.ShowMinimizeButton && true;
                this.ShowRestoreButton   = this.ShowRestoreButton && true;
                this.EnableRestoreButton = this.EnableRestoreButton && true;
                break;

            case ResizeMode.CanResizeWithGrip:
                this.ShowMinimizeButton  = this.ShowRestoreButton && true;
                this.ShowRestoreButton   = this.ShowRestoreButton && true;
                this.EnableRestoreButton = this.EnableRestoreButton && true;
                break;

            case ResizeMode.NoResize:
                this.ShowMinimizeButton  = this.ShowMinimizeButton && false;
                this.ShowRestoreButton   = this.ShowRestoreButton && false;
                this.EnableRestoreButton = this.EnableRestoreButton && false;
                break;

            default:
                break;
            }
        }