void ApplyStyleToLayoutItem(LayoutItem layoutItem)
 {
     layoutItem._ClearDefaultBindings();
     if (LayoutItemContainerStyle != null)
         layoutItem.Style = LayoutItemContainerStyle;
     else if (LayoutItemContainerStyleSelector != null)
         layoutItem.Style = LayoutItemContainerStyleSelector.SelectStyle(layoutItem.Model, layoutItem);
     layoutItem._SetDefaultBindings();
 }
 /// <summary>
 /// Provides a secure method for setting the LayoutItem property.  
 /// This dependency property indicates the LayoutItem attached to this tag item.
 /// </summary>
 /// <param name="value">The new value for the property.</param>
 protected void SetLayoutItem(LayoutItem value)
 {
     SetValue(LayoutItemPropertyKey, value);
 }
 /// <summary>
 /// Provides a secure method for setting the LayoutItem property.
 /// This dependency property indicates the LayoutItem attached to this tag item.
 /// </summary>
 /// <param name="value">The new value for the property.</param>
 protected void SetLayoutItem(LayoutItem value)
 {
     SetValue(LayoutItemPropertyKey, value);
 }
Esempio n. 4
0
		private void WriteSize(LayoutPartSize size, ILayoutPositionableElement element, LayoutItem layoutItem)
		{
			if (element != null)
			{
				var container = (ILayoutOrientableGroup)element.Parent;
				switch (container.Orientation)
				{
					case Orientation.Horizontal:
						element.DockMinWidth = size.MinWidth;
						element.IsDockWidthFixed = size.IsWidthFixed;
						element.DockWidth = new GridLength(size.Width, size.WidthType);
						//layoutItem.View.Width = size.WidthType == GridUnitType.Auto ? (size.Width < size.MinWidth ? size.MinWidth : size.Width) : double.NaN;
						break;
					case Orientation.Vertical:
						element.DockMinHeight = size.MinHeight;
						element.IsDockHeightFixed = size.IsHeightFixed;
						element.DockHeight = new GridLength(size.Height, size.HeightType);
						//layoutItem.View.Height = size.HeightType == GridUnitType.Auto ? (size.Height < size.MinHeight?size.MinHeight:size.Height): double.NaN;
						break;
				}
			}
		}
Esempio n. 5
0
		private void ReadSize(LayoutPartSize size, ILayoutPositionableElement element, LayoutItem layoutItem)
		{
			if (element != null)
			{
				var container = (ILayoutOrientableGroup)element.Parent;
				switch (container.Orientation)
				{
					case Orientation.Horizontal:
						size.MinWidth = element.DockMinWidth;
						size.IsWidthFixed = element.IsDockWidthFixed;
						size.WidthType = element.DockWidth.GridUnitType;
						//size.Width = element.DockWidth.IsAuto ? layoutItem.View.Width : element.DockWidth.Value;
						size.Width = element.DockWidth.Value;
						break;
					case Orientation.Vertical:
						size.MinHeight = element.DockMinHeight;
						size.IsHeightFixed = element.IsDockHeightFixed;
						size.HeightType = element.DockHeight.GridUnitType;
						//size.Height = element.DockHeight.IsAuto ? layoutItem.View.Height : element.DockHeight.Value;
						size.Height = element.DockHeight.Value;
						break;
				}
			}
		}
Esempio n. 6
0
		void WriteSize(LayoutPartSize size, ILayoutPositionableElement element, LayoutItem layoutItem)
		{
			if (element != null)
			{
				var container = (ILayoutOrientableGroup)element.Parent;
				switch (container.Orientation)
				{
					case Orientation.Horizontal:
						element.DockMinWidth = size.MinWidth;
						element.IsDockWidthFixed = size.IsWidthFixed;
						element.DockWidth = new GridLength(size.Width, size.WidthType);
						break;
					case Orientation.Vertical:
						element.DockMinHeight = size.MinHeight;
						element.IsDockHeightFixed = size.IsHeightFixed;
						element.DockHeight = new GridLength(size.Height, size.HeightType);
						break;
				}
			}
		}
Esempio n. 7
0
 static LayoutItem()
 {
     LayoutItem.TitleProperty                         = DependencyProperty.Register("Title", typeof(string), typeof(LayoutItem), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(LayoutItem.OnTitleChanged)));
     LayoutItem.IconSourceProperty                    = DependencyProperty.Register("IconSource", typeof(ImageSource), typeof(LayoutItem), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(LayoutItem.OnIconSourceChanged)));
     LayoutItem.ContentIdProperty                     = DependencyProperty.Register("ContentId", typeof(string), typeof(LayoutItem), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(LayoutItem.OnContentIdChanged)));
     LayoutItem.IsSelectedProperty                    = DependencyProperty.Register("IsSelected", typeof(bool), typeof(LayoutItem), new FrameworkPropertyMetadata(false, new PropertyChangedCallback(LayoutItem.OnIsSelectedChanged)));
     LayoutItem.IsActiveProperty                      = DependencyProperty.Register("IsActive", typeof(bool), typeof(LayoutItem), new FrameworkPropertyMetadata(false, new PropertyChangedCallback(LayoutItem.OnIsActiveChanged)));
     LayoutItem.CanCloseProperty                      = DependencyProperty.Register("CanClose", typeof(bool), typeof(LayoutItem), new FrameworkPropertyMetadata(true, new PropertyChangedCallback(LayoutItem.OnCanCloseChanged)));
     LayoutItem.CanFloatProperty                      = DependencyProperty.Register("CanFloat", typeof(bool), typeof(LayoutItem), new FrameworkPropertyMetadata(true, new PropertyChangedCallback(LayoutItem.OnCanFloatChanged)));
     LayoutItem.CloseCommandProperty                  = DependencyProperty.Register("CloseCommand", typeof(ICommand), typeof(LayoutItem), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(LayoutItem.OnCloseCommandChanged), new CoerceValueCallback(LayoutItem.CoerceCloseCommandValue)));
     LayoutItem.FloatCommandProperty                  = DependencyProperty.Register("FloatCommand", typeof(ICommand), typeof(LayoutItem), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(LayoutItem.OnFloatCommandChanged), new CoerceValueCallback(LayoutItem.CoerceFloatCommandValue)));
     LayoutItem.DockAsDocumentCommandProperty         = DependencyProperty.Register("DockAsDocumentCommand", typeof(ICommand), typeof(LayoutItem), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(LayoutItem.OnDockAsDocumentCommandChanged), new CoerceValueCallback(LayoutItem.CoerceDockAsDocumentCommandValue)));
     LayoutItem.CloseAllButThisCommandProperty        = DependencyProperty.Register("CloseAllButThisCommand", typeof(ICommand), typeof(LayoutItem), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(LayoutItem.OnCloseAllButThisCommandChanged), new CoerceValueCallback(LayoutItem.CoerceCloseAllButThisCommandValue)));
     LayoutItem.CloseAllCommandProperty               = DependencyProperty.Register("CloseAllCommand", typeof(ICommand), typeof(LayoutItem), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(LayoutItem.OnCloseAllCommandChanged), new CoerceValueCallback(LayoutItem.CoerceCloseAllCommandValue)));
     LayoutItem.ActivateCommandProperty               = DependencyProperty.Register("ActivateCommand", typeof(ICommand), typeof(LayoutItem), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(LayoutItem.OnActivateCommandChanged), new CoerceValueCallback(LayoutItem.CoerceActivateCommandValue)));
     LayoutItem.NewVerticalTabGroupCommandProperty    = DependencyProperty.Register("NewVerticalTabGroupCommand", typeof(ICommand), typeof(LayoutItem), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(LayoutItem.OnNewVerticalTabGroupCommandChanged)));
     LayoutItem.NewHorizontalTabGroupCommandProperty  = DependencyProperty.Register("NewHorizontalTabGroupCommand", typeof(ICommand), typeof(LayoutItem), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(LayoutItem.OnNewHorizontalTabGroupCommandChanged)));
     LayoutItem.MoveToNextTabGroupCommandProperty     = DependencyProperty.Register("MoveToNextTabGroupCommand", typeof(ICommand), typeof(LayoutItem), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(LayoutItem.OnMoveToNextTabGroupCommandChanged)));
     LayoutItem.MoveToPreviousTabGroupCommandProperty = DependencyProperty.Register("MoveToPreviousTabGroupCommand", typeof(ICommand), typeof(LayoutItem), new FrameworkPropertyMetadata(null, new PropertyChangedCallback(LayoutItem.OnMoveToPreviousTabGroupCommandChanged)));
     FrameworkElement.ToolTipProperty.OverrideMetadata(typeof(LayoutItem), new FrameworkPropertyMetadata(null, (DependencyObject s, DependencyPropertyChangedEventArgs e) => LayoutItem.OnToolTipChanged(s, e)));
     UIElement.VisibilityProperty.OverrideMetadata(typeof(LayoutItem), new FrameworkPropertyMetadata((object)System.Windows.Visibility.Visible, (DependencyObject s, DependencyPropertyChangedEventArgs e) => LayoutItem.OnVisibilityChanged(s, e)));
 }