Ejemplo n.º 1
0
        public override void WriteProperties(DependencyObject dependencyObject, XElement element)
        {
            var layoutProperties = BaseLayout.GetLayoutProperties(_layoutType);

            foreach (var layoutProperty in layoutProperties)
            {
                if (BaseLayout.ShouldSerializeProperty(_layoutType, dependencyObject, layoutProperty) == false)
                {
                    continue;
                }

                var value = dependencyObject.GetValue(layoutProperty);

                if (value == null)
                {
                    continue;
                }

                var stringValue = Convert.ToString(value, CultureInfo.InvariantCulture);

                if (string.IsNullOrEmpty(stringValue))
                {
                    continue;
                }

                var propertyName = FormatProperty(_layoutType, layoutProperty.GetName());

                element.Add(new XAttribute(propertyName, stringValue));
            }
        }
Ejemplo n.º 2
0
        public DockTabViewItem(DockItem dockItem)
        {
            this.OverrideStyleKey <DockTabViewItem>();

            DockItem = dockItem;

            SetBinding(HeaderProperty, new Binding {
                Path = new PropertyPath(DockItem.TitleProperty), Source = dockItem
            });
            SetBinding(IconProperty, new Binding {
                Path = new PropertyPath(DockItem.IconProperty), Source = dockItem
            });
            SetBinding(DisplayIndexProperty, new Binding {
                Path = new PropertyPath(BaseLayout.GetDockItemIndexProperty <TabLayout>()), Source = dockItem, Converter = DisplayIndexConverter.Instance, Mode = BindingMode.TwoWay
            });

            DataContext = dockItem;

            DragOutBehavior = new DragOutBehavior
            {
                DragOutCommand       = new RelayCommand(OnDragOutCommandExecuted),
                ProcessHandledEvents = true,
                Target = this
            };

            CloseCommand          = StaticCloseCommand;
            CloseCommandParameter = this;
        }
Ejemplo n.º 3
0
        protected DockItemGroup(DockItemState dockState, BaseLayout layout) : base(dockState)
        {
            Items       = new DockItemCollection(OnItemAdded, OnItemRemoved, true);
            ActualItems = new Dictionary <DockItem, DockItem>();

            Layout = layout;
            Layout.SetBinding(BaseLayout.SelectedItemProperty, new Binding {
                Path = new PropertyPath(SelectedItemProperty), Mode = BindingMode.TwoWay, Source = this
            });
        }
Ejemplo n.º 4
0
 public static IEnumerable <DependencyProperty> GetLayoutProperties(LayoutKind layoutKind)
 {
     return(BaseLayout.GetLayoutProperties(GetLayoutType(layoutKind)));
 }