Ejemplo n.º 1
0
        private static ItemsPanelTemplate GetDefaultItemsPanel()
        {
            ItemsPanelTemplate template = new ItemsPanelTemplate()
            {
                _methodToInstantiateFrameworkTemplate = (Control templateOwner) =>
                {
                    return(new TemplateInstance()
                    {
                        // Default items panel.
                        // Note: the parameter templateOwner is made necessary
                        // for the ControlTemplates but can be kept null for DataTemplates.
                        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);
        }
Ejemplo n.º 2
0
        public ColorGridBox()
        {
            // ItemsPanel template
            FrameworkElementFactory factoryUnigrid = new FrameworkElementFactory(typeof(UniformGrid));

            factoryUnigrid.SetValue(UniformGrid.ColumnsProperty, 8);
            ItemsPanel = new ItemsPanelTemplate(factoryUnigrid);

            // fill the list
            foreach (string strColor in strColors)
            {
                // rect
                Rectangle rect = new Rectangle()
                {
                    Width  = 12,
                    Height = 12,
                    Margin = new Thickness(4),
                    Fill   = (Brush)typeof(Brushes).GetProperty(strColor).GetValue(null, null)
                };
                Items.Add(rect);

                // tooltip
                ToolTip tip = new ToolTip()
                {
                    Content = strColor
                };
                rect.ToolTip = tip;
            }

            SelectedValuePath = "Fill";
        }
Ejemplo n.º 3
0
        private static void ItemsPanelChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            AdaptiveCollectionView obj   = (AdaptiveCollectionView)d;
            ItemsPanelTemplate     value = (ItemsPanelTemplate)e.NewValue;

            obj.SetBaseItemsPanel(value);
        }
Ejemplo n.º 4
0
        public ColorWheel()
        {
            // Defining template of ItemsPanel
            FrameworkElementFactory factoryRadialPanel =
                new FrameworkElementFactory(typeof(RadialPanel));

            ItemsPanel = new ItemsPanelTemplate(factoryRadialPanel);

            // Creation DataTemplate object for options
            DataTemplate template = new DataTemplate(typeof(Brush));

            ItemTemplate = template;

            // Creation FrameworkElementFactory based on Rectangle
            FrameworkElementFactory elRectangle =
                new FrameworkElementFactory(typeof(Rectangle));

            elRectangle.SetValue(Rectangle.WidthProperty, 4.0);
            elRectangle.SetValue(Rectangle.HeightProperty, 12.0);
            elRectangle.SetValue(Rectangle.MarginProperty,
                                 new Thickness(1, 8, 1, 8));
            elRectangle.SetBinding(Rectangle.FillProperty, new Binding(""));

            // Setting elRectangle as VisualTree node
            template.VisualTree = elRectangle;

            // Filling list ListBox
            PropertyInfo[] prps = typeof(Brushes).GetProperties();
            foreach (PropertyInfo prop in prps)
            {
                Items.Add((Brush)prop.GetValue(null, null));
            }
        }
Ejemplo n.º 5
0
        public void tableView()
        {
            GridViewColumn col1 = new GridViewColumn();

            col1.Header = "Название";
            col1.DisplayMemberBinding = new System.Windows.Data.Binding("Name");

            GridViewColumn col2 = new GridViewColumn();

            col2.Header = "Стоимость";
            col2.DisplayMemberBinding = new System.Windows.Data.Binding("Price");

            GridViewColumn col3 = new GridViewColumn();

            col3.Header = "Вес";
            col3.DisplayMemberBinding = new System.Windows.Data.Binding("Weight");

            GridView GV = new GridView();

            GV.Columns.Add(col1);
            GV.Columns.Add(col2);
            GV.Columns.Add(col3);

            this.listView.View = GV;

            ItemsPanelTemplate      IPT   = new ItemsPanelTemplate();
            FrameworkElementFactory FEFUG = new FrameworkElementFactory(typeof(StackPanel));

            FEFUG.SetValue(StackPanel.OrientationProperty, System.Windows.Controls.Orientation.Vertical);
            IPT.VisualTree           = FEFUG;
            this.listView.ItemsPanel = IPT;
        }
Ejemplo n.º 6
0
        private static void InitPanel()
        {
            var itemsPanelTemplate = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(FlyoutPanel)));

            itemsPanelTemplate.Seal();
            ItemsPanelProperty.OverrideMetadata(typeof(AutoHideGroupControl), new FrameworkPropertyMetadata(itemsPanelTemplate));
        }
        public void TestItemsPanel()
        {
            var lb       = ListBox();
            var template = new ItemsPanelTemplate();

            lb.ItemsPanel(template).ItemsPanel.Should().Be(template);
        }
Ejemplo n.º 8
0
        private static FrameworkPropertyMetadata ItemsPanelMetadata()
        {
            var defaultPanelTemplate = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(TimelineCompactPanel)));
            var md = new FrameworkPropertyMetadata(defaultPanelTemplate);

            return(md);
        }
Ejemplo n.º 9
0
 public ConnectionItemsControl()
 {
     ItemsPanel = new ItemsPanelTemplate()
     {
         VisualTree = new FrameworkElementFactory(typeof(Canvas))
     };
 }
Ejemplo n.º 10
0
        void EndlessGrid_Loaded(object sender, RoutedEventArgs e)
        {
            // Create ItemsControl in Canvas to bind the grid line onto it
            this.itemsControl = new ItemsControl();

            FrameworkElementFactory factoryPanel = new FrameworkElementFactory(typeof(Canvas));

            factoryPanel.SetValue(StackPanel.IsItemsHostProperty, true);

            ItemsPanelTemplate template = new ItemsPanelTemplate();

            template.VisualTree = factoryPanel;

            itemsControl.ItemsPanel = template;


            this.Children.Add(itemsControl);

            this.Background = Brushes.Transparent;

            // Call ViewModel to compute data required for View
            ((EndlessGridViewModel)this.DataContext).InitializeOnce();

            CreateBinding();
        }
Ejemplo n.º 11
0
        static object GetDefaultItemsPanelTemplate()
        {
            ItemsPanelTemplate itemsPanelTemplate = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(UniformGrid)));

            itemsPanelTemplate.Seal();
            return(itemsPanelTemplate);
        }
Ejemplo n.º 12
0
        static BottomScrolledItemsControl()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(BottomScrolledItemsControl), new FrameworkPropertyMetadata(typeof(BottomScrolledItemsControl)));
            ItemsPanelTemplate itemsPanel = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(VirtualizingStackPanel)));

            ItemsPanelProperty.OverrideMetadata(typeof(BottomScrolledItemsControl), new FrameworkPropertyMetadata(itemsPanel));
        }
Ejemplo n.º 13
0
        public ColorGridBox()
        {
            // Definition of template of ItemsPanel
            FrameworkElementFactory factoryUnigrid =
                new FrameworkElementFactory(typeof(UniformGrid));

            factoryUnigrid.SetValue(UniformGrid.ColumnsProperty, 8);
            ItemsPanel = new ItemsPanelTemplate(factoryUnigrid);

            // Filling list
            foreach (string strColor in strColors)
            {
                // Creation Rectangle object & adding it in ListBox
                Rectangle rect = new Rectangle();
                rect.Width  = 12;
                rect.Height = 12;
                rect.Margin = new Thickness(4);
                rect.Fill   = (Brush)
                              typeof(Brushes).GetProperty(strColor).GetValue(null, null);
                Items.Add(rect);

                // Creation ToolTip object for Rectangle
                ToolTip tip = new ToolTip();
                tip.Content  = strColor;
                rect.ToolTip = tip;
            }

            // В качестве SelectedValue выбирается
            // свойство Fill объекта Rectangle
            SelectedValuePath = "Fill";
        }
Ejemplo n.º 14
0
        private void OnCommandsPanelChanged(ItemsPanelTemplate current)
        {
            if (!IsTemplateApplied)
            {
                return;
            }


            /*if (null != commandsPanel)
             * {
             *  var panel = commandsPanel.Template;
             *
             *  buttonsGrid.Children.Remove(panel);
             *  panel.ClearValue(Grid.ColumnProperty);
             * }
             *
             * commandsPanel = current;
             *
             * if (null != commandsPanel)
             * {
             *  var panel = commandsPanel.Template;
             *
             *  Grid.SetColumn(panel, 1);
             *  buttonsGrid.Children.Add(panel);
             * //                panel.HorizontalAlignment = HorizontalAlignment.Right;
             * //                panel.VerticalAlignment = VerticalAlignment.Stretch;
             * }*/
        }
Ejemplo n.º 15
0
        static void OnItemsPanel_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ItemsControl       element     = (ItemsControl)d;
            ItemsPanelTemplate newTemplate = (ItemsPanelTemplate)e.NewValue;

            element.UpdateItemsPanel(newTemplate);
        }
        public static FrameworkElement Render(AdaptiveImageSet imageSet, AdaptiveRenderContext context)
        {
            var uiImageSet = new ListBox();

            uiImageSet.BorderThickness = new Thickness(0);
            uiImageSet.Background      = new SolidColorBrush(Colors.Transparent);
            ScrollViewer.SetHorizontalScrollBarVisibility(uiImageSet, ScrollBarVisibility.Disabled);
            var itemsPanelTemplate = new ItemsPanelTemplate();
            var factory            = new FrameworkElementFactory(typeof(WrapPanel));

            // factory.SetValue(StackPanel.OrientationProperty, Orientation.Horizontal);
            itemsPanelTemplate.VisualTree = factory;
            uiImageSet.ItemsPanel         = itemsPanelTemplate;

            uiImageSet.Style = context.GetStyle("Adaptive.ImageSet");
            foreach (var image in imageSet.Images)
            {
                if (image.Size == AdaptiveImageSize.Auto)
                {
                    if (imageSet.ImageSize != AdaptiveImageSize.Auto)
                    {
                        image.Size = imageSet.ImageSize;
                    }
                    else
                    {
                        image.Size = context.Config.ImageSet.ImageSize;
                    }
                }

                var uiImage = context.Render(image);
                uiImageSet.Add(uiImage);
            }
            return(uiImageSet);
        }
Ejemplo n.º 17
0
        private static ItemsPanelTemplate GetDefaultItemsPanelTemplate()
        {
            ItemsPanelTemplate template = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(DrawingCanvas)));

            template.Seal();
            return(template);
        }
Ejemplo n.º 18
0
        public VirtualizingItemsControl()
        {
            ItemsPanel = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(VirtualizingStackPanel)));

            string template = @"
            <ControlTemplate xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'>
                <Border
                    BorderThickness='{TemplateBinding Border.BorderThickness}'
                    Padding='{TemplateBinding Control.Padding}'
                    BorderBrush='{TemplateBinding Border.BorderBrush}'
                    Background='{TemplateBinding Panel.Background}'
                    SnapsToDevicePixels='True'>
                    <ScrollViewer
                        Padding='{TemplateBinding Control.Padding}'
                        Focusable='False'>
                        <ItemsPresenter
                            SnapsToDevicePixels='{TemplateBinding UIElement.SnapsToDevicePixels}'/>
                    </ScrollViewer>
                </Border>
            </ControlTemplate>";

            Template = (ControlTemplate)XamlReader.Parse(template);

            ScrollViewer.SetCanContentScroll(this, true);

            ScrollViewer.SetVerticalScrollBarVisibility(this, ScrollBarVisibility.Auto);
            ScrollViewer.SetHorizontalScrollBarVisibility(this, ScrollBarVisibility.Auto);

            VirtualizingPanel.SetCacheLengthUnit(this, VirtualizationCacheLengthUnit.Page);
            VirtualizingPanel.SetCacheLength(this, new VirtualizationCacheLength(1));

            VirtualizingPanel.SetIsVirtualizingWhenGrouping(this, true);
        }
Ejemplo n.º 19
0
        public ColorGridBox()
        {
            // ItemsPanel template을 정의
            FrameworkElementFactory factoryUnigrid =
                new FrameworkElementFactory(typeof(UniformGrid));

            factoryUnigrid.SetValue(UniformGrid.ColumnsProperty, 8);
            // ListBox의 ItemsPanel 속성에 UniformGrid로 설정
            ItemsPanel = new ItemsPanelTemplate(factoryUnigrid);
            // ListBox에 아이템을 넣는다.
            foreach (string strColor in strColors)
            {
                // 직사각형(Rectangle)을 생성하고 ListBox에 넣는다.
                Rectangle rect = new Rectangle();
                rect.Width  = 12;
                rect.Height = 12;
                rect.Margin = new Thickness(4);
                //
                rect.Fill = (Brush)
                            typeof(Brushes).GetProperty(strColor).GetValue(null, null);
                Items.Add(rect);
                // 직사각형(Rectangle에 툴팁 추가)
                ToolTip tip = new ToolTip();
                tip.Content  = strColor;
                rect.ToolTip = tip;
            }
            // Indicate that SelectedValue is Fill property of Rectangle item.
            SelectedValuePath = "Fill";
        }
Ejemplo n.º 20
0
        public ColorGridBox()
        {
            //Определение шаблона и его включение в ListBox
            FrameworkElementFactory factoryUnigrid = new  FrameworkElementFactory(typeof(UniformGrid));

            factoryUnigrid.SetValue(UniformGrid.ColumnsProperty, 8);
            ItemsPanel = new ItemsPanelTemplate(factoryUnigrid);

            //заполнение списка
            foreach (string strColor in strColors)
            {
                //Создание объекта Rectangle и включение его в ListBox
                Rectangle rect = new Rectangle();
                rect.Width  = 12;
                rect.Height = 12;
                rect.Margin = new Thickness(4);
                rect.Fill   = (Brush)
                              typeof(Brushes).GetProperty(strColor).GetValue(null, null);
                Items.Add(rect);

                //Создание объекта ToolTip для Rectangle
                ToolTip tip = new ToolTip();
                tip.Content  = strColor;
                rect.ToolTip = tip;
            }
            //В качестве выбранного значения выбирается свойствo fill объекта Rectangle
            SelectedValuePath = "Fill";
        }
Ejemplo n.º 21
0
        public void Tiling(e_bool e = e_bool.manual)
        {
            var a = new ObservableCollection <ChartData>(vm.Vms);

            vm.Vms.Clear();

            if ((istile == true && e == e_bool.manual) || e == e_bool.True)
            {
                FrameworkElementFactory factory  = new FrameworkElementFactory(typeof(StackPanel));
                ItemsPanelTemplate      template = new ItemsPanelTemplate();
                template.VisualTree = factory;
                listBox.ItemsPanel  = template;
                istile = false;
            }
            else if ((istile == false && e == e_bool.manual) || e == e_bool.False)
            {
                FrameworkElementFactory factory = new FrameworkElementFactory(typeof(WrapPanel));
                factory.SetValue(WrapPanel.OrientationProperty, Orientation.Horizontal);
                ItemsPanelTemplate template = new ItemsPanelTemplate();
                template.VisualTree = factory;
                listBox.ItemsPanel  = template;
                istile = true;
            }

            foreach (var item in a)
            {
                item.ReFresh();
                vm.Vms.Add(item);
            }
        }
        static ItemsPanelTemplate GetDefaultItemsPanelTemplate()
        {
            ItemsPanelTemplate template = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(StackPanel)));

            template.Seal();
            return(template);
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Constructor for ColorPickerControl, which is a ListBox subclass
        /// </summary>
        public ColorPickerControl()
        {
            // Define a template for the Items, used the lazy FrameworkElementFactory
            // method
            FrameworkElementFactory fGrid = new
                                            FrameworkElementFactory(typeof(System.Windows.Controls.Primitives.UniformGrid));

            fGrid.SetValue(System.Windows.Controls.Primitives.UniformGrid.ColumnsProperty, 10);
            //update the ListBox ItemsPanel with the new ItemsPanelTemplate just created
            ItemsPanel = new ItemsPanelTemplate(fGrid);


            // Create individual items
            foreach (string clr in _sColors)
            {
                // Creat bounding rectnagle for items data
                Rectangle rItem = new Rectangle();
                rItem.Width  = 10;
                rItem.Height = 10;
                rItem.Margin = new Thickness(1);
                rItem.Fill   = (Brush)typeof(Brushes).GetProperty(clr).GetValue(null, null);
                //add rectangle to ListBox Items
                Items.Add(rItem);

                //add a tooltip
                ToolTip t = new ToolTip();
                t.Content     = clr;
                rItem.ToolTip = t;
            }
            //Indicate that SelectedValue is Fill property of Rectangle item.
            //Kind of like an XPath query, this is the string name of the property
            //to use as the the selected item value from the actual item data. The item
            //data being a Rectangle in this case
            SelectedValuePath = "Fill";
        }
Ejemplo n.º 24
0
        private void CreateSlider()
        {
            flipViewWrap = new FlipView();

            WebView[][] webViews = new WebView[urls.Length][];

            FlipView[] flipViews = new FlipView[urls.Length];

            for (int i = 0; i < urls.Length; i++)
            {
                flipViews[i] = new FlipView();
                webViews[i]  = new WebView[urls[i].Length];

                for (int j = 0; j < urls[i].Length; j++)
                {
                    webViews[i][j] = new WebView();

                    try
                    {
                        if (String.IsNullOrEmpty(urls[i][j]))
                        {
                            throw new Exception();
                        }
                        if (urls[i][j].Equals("about:blank"))
                        {
                            throw new Exception();
                        }
                        if (!urls[i][j].StartsWith("http://") && !urls[i][j].StartsWith("https://"))
                        {
                            urls[i][j] = "http://" + urls[i][j];
                        }

                        Uri targetUri;

                        if (Uri.TryCreate(urls[i][j], UriKind.Absolute, out targetUri)) // && (targetUri.Scheme == Uri.UriSchemeHttp))
                        {
                            webViews[i][j].Navigate(targetUri);
                        }
                        else
                        {
                            throw new Exception();
                        }
                    }
                    catch (Exception ex)
                    {
                        webViews[i][j].NavigateToString("<html><body><h2>Can't download " + urls[i][j] + "</h2></body></html>");
                        System.Diagnostics.Debug.Write(ex.ToString());
                    }
                }

                var itemsPanelTemplate = new ItemsPanelTemplate();
                itemsPanelTemplate.SetValue(VirtualizingStackPanel.OrientationProperty, Orientation.Vertical);
                flipViews[i].ItemsPanel  = itemsPanelTemplate;
                flipViews[i].ItemsSource = webViews[i];
            }

            flipViewWrap.ItemsSource = flipViews;

            sliderWrap.Children.Add(flipViewWrap);
        }
Ejemplo n.º 25
0
        public static ItemsPanelTemplate CreateItemsPanelTemplate <T>() where T : Panel
        {
            ItemsPanelTemplate template = new ItemsPanelTemplate(new FrameworkElementFactory(typeof(T)));

            template.Seal();
            return(template);
        }
Ejemplo n.º 26
0
        public ColorWheel()
        {
            // Define the ItemsPanel template
            var factoryRadialPanel = new FrameworkElementFactory(typeof(RadialPanel));

            ItemsPanel = new ItemsPanelTemplate(factoryRadialPanel);

            // Create the DataTemplate for the items
            var template = new DataTemplate(typeof(Brush));

            ItemTemplate = template;

            // Create a FrameworkElementFactory based on Rectangle with specific properties (like width, margin, etc.)
            var elRectangle = new FrameworkElementFactory(typeof(Rectangle));

            elRectangle.SetValue(Rectangle.WidthProperty, 4.0);
            elRectangle.SetValue(Rectangle.HeightProperty, 12.0);
            elRectangle.SetValue(Rectangle.MarginProperty,
                                 new Thickness(1, 8, 1, 8));
            elRectangle.SetBinding(Rectangle.FillProperty, new Binding(""));

            // Use that factory for the visual tree
            template.VisualTree = elRectangle;

            // Set the items in the ListBox
            var props = typeof(Brushes).GetProperties();

            // Add color selection into our panel
            foreach (var prop in props)
            {
                Items.Add((Brush)prop.GetValue(null, null));
            }
        }
Ejemplo n.º 27
0
        public ColorGridBox()
        {
            FrameworkElementFactory factoryUnigrid =
                new FrameworkElementFactory(typeof(UniformGrid));

            factoryUnigrid.SetValue(UniformGrid.ColumnsProperty, 8);

            ItemsPanel = new ItemsPanelTemplate(factoryUnigrid);

            foreach (string strColor in strColors)
            {
                Rectangle rect = new Rectangle();
                rect.Width  = 12;
                rect.Height = 12;
                rect.Margin = new Thickness(4);

                rect.Fill = (Brush)
                            typeof(Brushes).GetProperty(strColor).GetValue(null, null);
                Items.Add(rect);

                ToolTip tip = new ToolTip();
                tip.Content  = strColor;
                rect.ToolTip = tip;
            }
            SelectedValuePath = "Fill";
        }
Ejemplo n.º 28
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));
        }
Ejemplo n.º 29
0
 protected virtual void UpdateItemsPanel(ItemsPanelTemplate newTemplate)
 {
     if (this.ItemsPresenter != null)
     {
         this.ItemsPresenter.Template = newTemplate;
     }
 }
Ejemplo n.º 30
0
        public ColorGridBox()
        {
            // Define the ItemsPanel template.
            FrameworkElementFactory factoryUnigrid =
                new FrameworkElementFactory(typeof(UniformGrid));

            factoryUnigrid.SetValue(UniformGrid.ColumnsProperty, 8);
            ItemsPanel = new ItemsPanelTemplate(factoryUnigrid);

            // Add items to the ListBox.
            foreach (string strColor in strColors)
            {
                // Create Rectangle and add to ListBox.
                Rectangle rect = new Rectangle();
                rect.Width  = 12;
                rect.Height = 12;
                rect.Margin = new Thickness(4);
                rect.Fill   = (Brush)
                              typeof(Brushes).GetProperty(strColor).GetValue(null, null);
                Items.Add(rect);

                // Create ToolTip for Rectangle.
                ToolTip tip = new ToolTip();
                tip.Content  = strColor;
                rect.ToolTip = tip;
            }
            // Indicate that SelectedValue is Fill property of Rectangle item.
            SelectedValuePath = "Fill";
        }
Ejemplo n.º 31
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));
        }
Ejemplo n.º 32
0
        private static ItemsPanelTemplate CreateDefaultItemsPanelTemplate()
        {
            var panelTemplateFactory = new FrameworkElementFactory(typeof (StackPanel));
            panelTemplateFactory.SetValue(StackPanel.OrientationProperty, Orientation.Horizontal);
            var res = new ItemsPanelTemplate()
                {
                    VisualTree = panelTemplateFactory
                };

            return res;
        }
Ejemplo n.º 33
0
		protected virtual void OnTemplateChanged(ItemsPanelTemplate oldTemplate, ItemsPanelTemplate newTemplate)
		{
		}