init
This commit is contained in:
100
Common/DTS.CommonCore/RibbonControl/Classes/GalleryData.cs
Normal file
100
Common/DTS.CommonCore/RibbonControl/Classes/GalleryData.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace DTS.Common.RibbonControl
|
||||
{
|
||||
public class GalleryData : ControlData
|
||||
{
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ObservableCollection<GalleryCategoryData> CategoryDataCollection
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_controlDataCollection != null) return _controlDataCollection;
|
||||
_controlDataCollection = new ObservableCollection<GalleryCategoryData>();
|
||||
|
||||
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.GalleryCategoryCount; i++)
|
||||
{
|
||||
_controlDataCollection.Add(new GalleryCategoryData()
|
||||
{
|
||||
Label = "GalleryCategory " + i,
|
||||
SmallImage = smallImage,
|
||||
LargeImage = largeImage,
|
||||
ToolTipTitle = "ToolTip Title",
|
||||
ToolTipDescription = "ToolTip Description",
|
||||
ToolTipImage = smallImage,
|
||||
Command = ViewModelData.DefaultCommand
|
||||
});
|
||||
}
|
||||
return _controlDataCollection;
|
||||
}
|
||||
}
|
||||
private ObservableCollection<GalleryCategoryData> _controlDataCollection;
|
||||
|
||||
public GalleryItemData SelectedItem
|
||||
{
|
||||
get => _selectedItem;
|
||||
set
|
||||
{
|
||||
if (_selectedItem != value)
|
||||
{
|
||||
_selectedItem = value;
|
||||
OnPropertyChanged(new PropertyChangedEventArgs("SelectedItem"));
|
||||
}
|
||||
}
|
||||
}
|
||||
GalleryItemData _selectedItem;
|
||||
|
||||
public bool CanUserFilter
|
||||
{
|
||||
get => _canUserFilter;
|
||||
|
||||
set
|
||||
{
|
||||
if (_canUserFilter == value) return;
|
||||
_canUserFilter = value;
|
||||
OnPropertyChanged(new PropertyChangedEventArgs("CanUserFilter"));
|
||||
}
|
||||
}
|
||||
|
||||
private bool _canUserFilter;
|
||||
}
|
||||
|
||||
public class GalleryData<T> : ControlData
|
||||
{
|
||||
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
|
||||
public ObservableCollection<GalleryCategoryData<T>> CategoryDataCollection => _controlDataCollection ?? (_controlDataCollection = new ObservableCollection<GalleryCategoryData<T>>());
|
||||
|
||||
private ObservableCollection<GalleryCategoryData<T>> _controlDataCollection;
|
||||
|
||||
public T SelectedItem
|
||||
{
|
||||
get => _selectedItem;
|
||||
set
|
||||
{
|
||||
if (Equals(value, _selectedItem)) return;
|
||||
_selectedItem = value;
|
||||
OnPropertyChanged(new PropertyChangedEventArgs("SelectedItem"));
|
||||
}
|
||||
}
|
||||
T _selectedItem;
|
||||
|
||||
public bool CanUserFilter
|
||||
{
|
||||
get => _canUserFilter;
|
||||
|
||||
set
|
||||
{
|
||||
if (_canUserFilter == value) return;
|
||||
_canUserFilter = value;
|
||||
OnPropertyChanged(new PropertyChangedEventArgs("CanUserFilter"));
|
||||
}
|
||||
}
|
||||
|
||||
private bool _canUserFilter;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user