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)); } }
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; }
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 }); }
public static IEnumerable <DependencyProperty> GetLayoutProperties(LayoutKind layoutKind) { return(BaseLayout.GetLayoutProperties(GetLayoutType(layoutKind))); }