/// <summary> /// 以Float模式向DockManager注册一个DockElement /// </summary> /// <param name="title">标题栏文字</param> /// <param name="content">内容</param> /// <param name="imageSource">标题栏图标</param> /// <param name="side">停靠方向(默认左侧)</param> /// <param name="desiredWidth">期望的宽度</param> /// <param name="desiredHeight">期望的高度</param> /// <returns></returns> public void RegisterFloat(IDockSource content, DockSide side = DockSide.Left, double desiredWidth = Constants.DockDefaultWidthLength, double desiredHeight = Constants.DockDefaultHeightLength) { DockElement ele = new DockElement() { ID = id++, Title = content.Header, Content = content as UIElement, ImageSource = content.Icon, Side = side, Mode = DockMode.Float, DesiredWidth = desiredWidth, DesiredHeight = desiredHeight }; var ctrl = new DockControl(ele); var group = new LayoutGroup(side, ele.Mode, this); group.Attach(ele); AddDockControl(ctrl); content.DockControl = ctrl; }
/// <summary> /// 以选项卡模式向DockManager注册一个DockElement /// </summary> /// <param name="title">标题栏文字</param> /// <param name="content">内容</param> /// <param name="imageSource">标题栏图标</param> /// <param name="canSelect">是否直接停靠在选项栏中供用户选择(默认为False)</param> /// <param name="desiredWidth">期望的宽度</param> /// <param name="desiredHeight">期望的高度</param> /// <returns></returns> public void RegisterDocument(IDockSource content, bool canSelect = false, double desiredWidth = Constants.DockDefaultWidthLength, double desiredHeight = Constants.DockDefaultHeightLength) { DockElement ele = new DockElement(true) { ID = id++, Title = content.Header, Content = content as UIElement, ImageSource = content.Icon, Side = DockSide.None, Mode = DockMode.Normal, CanSelect = canSelect, DesiredWidth = desiredWidth, DesiredHeight = desiredHeight }; var ctrl = new DockControl(ele); AddDockControl(ctrl); _root.DocumentModels[0].Attach(ele); content.DockControl = ctrl; }
/// <summary> /// 以Float模式向DockManager注册一个DockElement /// </summary> /// <param name="title">标题栏文字</param> /// <param name="content">内容</param> /// <param name="imageSource">标题栏图标</param> /// <param name="side">停靠方向(默认左侧)</param> /// <param name="desiredWidth">期望的宽度</param> /// <param name="desiredHeight">期望的高度</param> /// <returns></returns> public void RegisterFloat(IDockSource content, DockSide side = DockSide.Left, int?id = null, double desiredWidth = Constants.DockDefaultWidthLength, double desiredHeight = Constants.DockDefaultHeightLength, double floatLeft = 0.0, double floatTop = 0.0) { DockElement ele = new DockElement() { ID = id.HasValue ? id.Value : _GetID(), Title = content.Header, Content = content, ImageSource = content.Icon, Side = side, Mode = DockMode.Float, DesiredWidth = desiredWidth, DesiredHeight = desiredHeight, FloatLeft = floatLeft, FloatTop = floatTop }; var ctrl = new DockControl(ele); var group = new LayoutGroup(side, ele.Mode, this); group.Attach(ele); AddDockControl(ctrl); content.DockControl = ctrl; }
/// <summary> /// 以选项卡模式向DockManager注册一个DockElement /// </summary> /// <param name="title">标题栏文字</param> /// <param name="content">内容</param> /// <param name="imageSource">标题栏图标</param> /// <param name="canSelect">是否直接停靠在选项栏中供用户选择(默认为False)</param> /// <param name="desiredWidth">期望的宽度</param> /// <param name="desiredHeight">期望的高度</param> /// <returns></returns> public void RegisterDocument(IDockSource content, int?id = null, bool canSelect = false, double desiredWidth = Constants.DockDefaultWidthLength, double desiredHeight = Constants.DockDefaultHeightLength, double floatLeft = 0.0, double floatTop = 0.0) { DockElement ele = new DockElement(true) { ID = id.HasValue ? id.Value : _GetID(), Title = content.Header, Content = content, ImageSource = content.Icon, Side = DockSide.None, Mode = DockMode.Normal, CanSelect = canSelect, DesiredWidth = desiredWidth, DesiredHeight = desiredHeight, FloatLeft = floatLeft, FloatTop = floatTop }; var ctrl = new DockControl(ele); AddDockControl(ctrl); _root.DocumentModels[0].Attach(ele); content.DockControl = ctrl; }