init
This commit is contained in:
118
Common/DTS.Common/RibbonControl/Classes/MenuButtonData.cs
Normal file
118
Common/DTS.Common/RibbonControl/Classes/MenuButtonData.cs
Normal file
@@ -0,0 +1,118 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DTS.Common.RibbonControl
|
||||
{
|
||||
public class MenuButtonData : ControlData
|
||||
{
|
||||
public MenuButtonData()
|
||||
: this(false)
|
||||
{
|
||||
}
|
||||
|
||||
public MenuButtonData(bool isApplicationMenu)
|
||||
{
|
||||
_isApplicationMenu = isApplicationMenu;
|
||||
}
|
||||
|
||||
public bool IsVerticallyResizable
|
||||
{
|
||||
get => _isVerticallyResizable;
|
||||
|
||||
set
|
||||
{
|
||||
if (_isVerticallyResizable == value) return;
|
||||
_isVerticallyResizable = value;
|
||||
OnPropertyChanged(new PropertyChangedEventArgs("IsVerticallyResizable"));
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsHorizontallyResizable
|
||||
{
|
||||
get => _isHorizontallyResizable;
|
||||
|
||||
set
|
||||
{
|
||||
if (_isHorizontallyResizable == value) return;
|
||||
_isHorizontallyResizable = value;
|
||||
OnPropertyChanged(new PropertyChangedEventArgs("IsHorizontallyResizable"));
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isVerticallyResizable, _isHorizontallyResizable;
|
||||
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ObservableCollection<ControlData> ControlDataCollection
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_controlDataCollection == null)
|
||||
{
|
||||
_controlDataCollection = new ObservableCollection<ControlData>();
|
||||
|
||||
if (_nestingDepth <= ViewModelData.MenuItemNestingCount)
|
||||
{
|
||||
_nestingDepth++;
|
||||
|
||||
var smallImage = new Uri("/Common;component/RibbonControl/Images/Paste_16x16.png", UriKind.Relative);
|
||||
var largeImage = new Uri("/Common;component/RibbonControl/Images/Paste_32x32.png", UriKind.Relative);
|
||||
|
||||
for (var i = 0; i < ViewModelData.GalleryCount; i++)
|
||||
{
|
||||
var galleryData = new GalleryData()
|
||||
{
|
||||
Label = "Gallery " + i,
|
||||
SmallImage = smallImage,
|
||||
LargeImage = largeImage,
|
||||
ToolTipTitle = "ToolTip Title",
|
||||
ToolTipDescription = "ToolTip Description",
|
||||
ToolTipImage = smallImage,
|
||||
Command = ViewModelData.DefaultCommand
|
||||
};
|
||||
galleryData.SelectedItem = galleryData.CategoryDataCollection[0].GalleryItemDataCollection[ViewModelData.GalleryItemCount - 1];
|
||||
|
||||
_controlDataCollection.Add(galleryData);
|
||||
}
|
||||
for (var i = 0; i < ViewModelData.MenuItemCount; i++)
|
||||
{
|
||||
var menuItemData = _isApplicationMenu ? new ApplicationMenuItemData(true) : new MenuItemData(false);
|
||||
menuItemData.Label = "MenuItem " + i;
|
||||
menuItemData.SmallImage = smallImage;
|
||||
menuItemData.LargeImage = largeImage;
|
||||
menuItemData.ToolTipTitle = "ToolTip Title";
|
||||
menuItemData.ToolTipDescription = "ToolTip Description";
|
||||
menuItemData.ToolTipImage = smallImage;
|
||||
menuItemData.Command = ViewModelData.DefaultCommand;
|
||||
menuItemData._nestingDepth = _nestingDepth;
|
||||
|
||||
_controlDataCollection.Add(menuItemData);
|
||||
}
|
||||
|
||||
_controlDataCollection.Add(new SeparatorData());
|
||||
|
||||
for (var i = 0; i < ViewModelData.SplitMenuItemCount; i++)
|
||||
{
|
||||
var splitMenuItemData = _isApplicationMenu ? new ApplicationSplitMenuItemData(true) : new SplitMenuItemData(false);
|
||||
splitMenuItemData.Label = "SplitMenuItem " + i;
|
||||
splitMenuItemData.SmallImage = smallImage;
|
||||
splitMenuItemData.LargeImage = largeImage;
|
||||
splitMenuItemData.ToolTipTitle = "ToolTip Title";
|
||||
splitMenuItemData.ToolTipDescription = "ToolTip Description";
|
||||
splitMenuItemData.ToolTipImage = smallImage;
|
||||
splitMenuItemData.Command = ViewModelData.DefaultCommand;
|
||||
splitMenuItemData._nestingDepth = _nestingDepth;
|
||||
splitMenuItemData.IsCheckable = true;
|
||||
|
||||
_controlDataCollection.Add(splitMenuItemData);
|
||||
}
|
||||
}
|
||||
}
|
||||
return _controlDataCollection;
|
||||
}
|
||||
}
|
||||
private ObservableCollection<ControlData> _controlDataCollection;
|
||||
private int _nestingDepth;
|
||||
private bool _isApplicationMenu;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user