Exemplo n.º 1
0
        protected override void UpdateVisualState()
        {
            Rect clipping;

            if (ElementRoot != null)
            {
                clipping = new Rect(0, 0, RenderSize.Width, RenderSize.Height);
                ElementClipping.SetValue(RectangleGeometry.RectProperty, clipping);
            }
        }
Exemplo n.º 2
0
        protected void UpdateVisualState()
        {
            Rect   clipping = new Rect(0, 0, Width, _panelSize.Height);
            double opacity  = (IsEnabled ? 1 : 0.8);

            if (ElementRoot != null)
            {
                ElementBackground.SetValue(Canvas.TopProperty, _panelSize.Height);
                ElementBackground.SetValue(Canvas.LeftProperty, 0d);
                ElementContent.SetValue(Canvas.TopProperty, _panelSize.Height);

                ElementText.Opacity     = opacity;
                ElementCheckBox.Opacity = opacity;
                ElementExpand.IsEnabled = IsEnabled;

                ElementExpand.Cursor = (IsEnabled ? Cursors.Hand : Cursors.Arrow);
                ElementText.Cursor   = ElementExpand.Cursor;

                ElementBackground.Width  = Width;
                ElementBackground.Height = Height - _panelSize.Height;

                clipping = new Rect(0, 0, Width, double.IsNaN(Height) ? _panelSize.Height : Height);
                if (_expanded)
                {
                    ElementBackground.Visibility = Visibility.Visible;
                }
                else if (_expandDirection == 0.0)
                {
                    ElementBackground.Visibility = Visibility.Collapsed;
                }

                ElementClipping.SetValue(RectangleGeometry.RectProperty, clipping);
                ElementText.Text = _text;

                if (_enableCheckbox)
                {
                    ElementCheckBox.IsChecked  = _checked;
                    ElementCheckBox.Visibility = Visibility.Visible;
                }
                else
                {
                    ElementCheckBox.Visibility = Visibility.Collapsed;
                }
            }
        }