示例#1
0
        //-------------------------------------------------------------------
        //
        //  Constructors
        //
        //-------------------------------------------------------------------

        #region Constructors

        static StatusBar()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(StatusBar), new FrameworkPropertyMetadata(typeof(StatusBar)));
            _dType = DependencyObjectType.FromSystemTypeInternal(typeof(StatusBar));

            IsTabStopProperty.OverrideMetadata(typeof(StatusBar), new FrameworkPropertyMetadata(BooleanBoxes.FalseBox));

            ItemsPanelTemplate template = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(DockPanel)));
            template.Seal();
            ItemsPanelProperty.OverrideMetadata(typeof(StatusBar), new FrameworkPropertyMetadata(template));
        }
        static HierarchicalGroupByControlNode()
        {
            // Default binding to HierarchicalGroupByControlNode value
            FrameworkElementFactory staircaseFactory   = new FrameworkElementFactory(typeof(StaircasePanel));
            ItemsPanelTemplate      itemsPanelTemplate = new ItemsPanelTemplate(staircaseFactory);
            RelativeSource          ancestorSource     = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(HierarchicalGroupByControl), 1);

            Binding binding = new Binding();

            binding.Path           = new PropertyPath(HierarchicalGroupByControlNode.ConnectionLineAlignmentProperty);
            binding.Mode           = BindingMode.OneWay;
            binding.RelativeSource = ancestorSource;
            staircaseFactory.SetBinding(StaircasePanel.ConnectionLineAlignmentProperty, binding);

            binding                = new Binding();
            binding.Path           = new PropertyPath(HierarchicalGroupByControlNode.ConnectionLineOffsetProperty);
            binding.Mode           = BindingMode.OneWay;
            binding.RelativeSource = ancestorSource;
            staircaseFactory.SetBinding(StaircasePanel.ConnectionLineOffsetProperty, binding);

            binding                = new Binding();
            binding.Path           = new PropertyPath(HierarchicalGroupByControlNode.ConnectionLinePenProperty);
            binding.Mode           = BindingMode.OneWay;
            binding.RelativeSource = ancestorSource;
            staircaseFactory.SetBinding(StaircasePanel.ConnectionLinePenProperty, binding);

            binding                = new Binding();
            binding.Path           = new PropertyPath(HierarchicalGroupByControlNode.StairHeightProperty);
            binding.Mode           = BindingMode.OneWay;
            binding.RelativeSource = ancestorSource;
            staircaseFactory.SetBinding(StaircasePanel.StairHeightProperty, binding);

            binding                = new Binding();
            binding.Path           = new PropertyPath(HierarchicalGroupByControlNode.StairSpacingProperty);
            binding.Mode           = BindingMode.OneWay;
            binding.RelativeSource = ancestorSource;
            staircaseFactory.SetBinding(StaircasePanel.StairSpacingProperty, binding);

            itemsPanelTemplate.Seal();

            ItemsControl.ItemsPanelProperty.OverrideMetadata(typeof(HierarchicalGroupByControlNode), new FrameworkPropertyMetadata(itemsPanelTemplate));
            DataGridControl.ParentDataGridControlPropertyKey.OverrideMetadata(typeof(HierarchicalGroupByControlNode), new FrameworkPropertyMetadata(new PropertyChangedCallback(HierarchicalGroupByControlNode.ParentGridControlChangedCallback)));
            FocusableProperty.OverrideMetadata(typeof(HierarchicalGroupByControlNode), new FrameworkPropertyMetadata(false));
        }
示例#3
0
        private static void OnOrientationChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ComboBox comboBox = (ComboBox)d;

            if (comboBox.gallery != null)
            {
                if ((Orientation)e.NewValue == Orientation.Horizontal)
                {
                    ItemsPanelTemplate template = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(WrapPanel)));
                    template.Seal();
                    comboBox.ItemsPanel = template;
                }
                else
                {
                    ItemsPanelTemplate template = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(StackPanel)));
                    template.Seal();
                    comboBox.ItemsPanel = template;
                }
            }
        }
示例#4
0
        static ApplicationBar()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(ApplicationBar), new FrameworkPropertyMetadata(typeof(ApplicationBar)));

            var itemsPanelTemplate = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(ApplicationBarPanel)));

            itemsPanelTemplate.Seal();
            ItemsPanelProperty.OverrideMetadata(typeof(ApplicationBar), new FrameworkPropertyMetadata(itemsPanelTemplate));

            IsTabStopProperty.OverrideMetadata(typeof(ApplicationBar), new FrameworkPropertyMetadata(false));
            FocusableProperty.OverrideMetadata(typeof(ApplicationBar), new FrameworkPropertyMetadata(false));
            FocusManager.IsFocusScopeProperty.OverrideMetadata(typeof(ApplicationBar), new FrameworkPropertyMetadata(true));
            KeyboardNavigation.DirectionalNavigationProperty.OverrideMetadata(typeof(ApplicationBar), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle));
            KeyboardNavigation.TabNavigationProperty.OverrideMetadata(typeof(ApplicationBar), new FrameworkPropertyMetadata(KeyboardNavigationMode.Cycle));
            KeyboardNavigation.ControlTabNavigationProperty.OverrideMetadata(typeof(ApplicationBar), new FrameworkPropertyMetadata(KeyboardNavigationMode.Once));

            HorizontalAlignmentProperty.OverrideMetadata(typeof(ApplicationBar), new FrameworkPropertyMetadata(HorizontalAlignment.Stretch));
            VerticalAlignmentProperty.OverrideMetadata(typeof(ApplicationBar), new FrameworkPropertyMetadata(VerticalAlignment.Bottom));

            EventManager.RegisterClassHandler(typeof(ApplicationBar), Mouse.LostMouseCaptureEvent, new MouseEventHandler(OnLostMouseCapture));
            EventManager.RegisterClassHandler(typeof(ApplicationBar), Mouse.PreviewMouseUpOutsideCapturedElementEvent, new MouseButtonEventHandler(OnPreviewMouseButtonOutsideCapturedElement));
        }
示例#5
0
        static ConvexView()
        {
            // Default style of the control
            DefaultStyleKeyProperty.OverrideMetadata(typeof(ConvexView), new FrameworkPropertyMetadata(typeof(ConvexView)));

            FrameworkPropertyMetadata scrollViewStyleMethadata = new FrameworkPropertyMetadata((Style)null);

            ScrollViewerStyleProperty = DependencyProperty.Register("ScrollViewerStyle", typeof(Style), typeof(ConvexView), scrollViewStyleMethadata);

            FrameworkPropertyMetadata invalidateLayoutOnMouseLeaveMethadata = new FrameworkPropertyMetadata(false);

            InvalidateLayoutOnMouseLeaveProperty = DependencyProperty.Register("InvalidateLayoutOnMouseLeave", typeof(bool), typeof(ConvexView), invalidateLayoutOnMouseLeaveMethadata);

            // We dont want to catch tab stops
            Control.IsTabStopProperty.OverrideMetadata(typeof(ConvexView), (PropertyMetadata) new FrameworkPropertyMetadata(false));

            // Overriding default items panel with ConvexPanel
            ItemsPanelTemplate itemsPanelTemplate = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(ConvexPanel)));

            itemsPanelTemplate.Seal();
            ItemsControl.ItemsPanelProperty.OverrideMetadata(typeof(ConvexView), (PropertyMetadata) new FrameworkPropertyMetadata((object)itemsPanelTemplate));
        }
        static AsyncDataGridColumnHeadersPresenter()
        {
            Type forType = typeof(AsyncDataGridColumnHeadersPresenter);

            DefaultStyleKeyProperty.OverrideMetadata(
                forType, new FrameworkPropertyMetadata(forType));

            // Arrange the headers in reverse order, i.e. from right to left,
            // to make the left header's gripper overlay the right header.
            var panelFactory = new FrameworkElementFactory(
                typeof(AsyncDataGridColumnHeadersPanel));

            panelFactory.SetValue(
                StackPanel.OrientationProperty,
                Orientation.Horizontal);

            var panelTemplate = new ItemsPanelTemplate(panelFactory);

            panelTemplate.Seal();

            ItemsPanelProperty.OverrideMetadata(
                forType, new FrameworkPropertyMetadata(panelTemplate));
        }
        private static ItemsPanelTemplate GetDefaultItemsPanel()
        {
            ItemsPanelTemplate template = new ItemsPanelTemplate()
            {
                _methodToInstantiateFrameworkTemplate = (FrameworkElement templateOwner) =>
                {
                    return(new TemplateInstance()
                    {
                        TemplateOwner = templateOwner,
                        TemplateContent = new StackPanel()
                    });
                }
            };

            template.Seal();

            // Note: We seal the template in order to avoid letting the user modify the
            // default template itself since it is the same instance that is used as
            // the default value for all ItemsControls.
            // This would bring issues such as a user modifying the default template
            // for one element then modifying it again for another one and both would
            // have the last one's template.
            return(template);
        }