PopupGallery Class
Represents a gallery control that can appear in a popup.
[TemplatePart(Name = "PART_ScrollViewer", Type = typeof(ScrollViewer))]
public class PopupGallery : GalleryBase, IKeyTipTarget, ILogicalParent, IVariantControl
- Inheritance:
- object Visual UIElement FrameworkElement Control ItemsControl ItemsControlBase GalleryBase object
- Derived:
- ColorPickerGallery
- Implements:
- IKeyTipTarget ILogicalParent IVariantControl
Remarks
For detailed documentation on this control's features and how to use them, please see the PopupGallery documentation topic.
Constructors
PopupGallery()
Initializes an instance of the class.
public PopupGallery()
Properties
CanFilter
Gets or sets whether the gallery can filter categorized items.
public bool CanFilter { get; set; }
Property Value
- bool:
true
if the gallery can filter categorized items; otherwise,false
. The default value isfalse
.
Remarks
This property requires that CategorizedItemsSource is not null
for it to function correctly.
CategorizedItemsSource
Gets or sets the items source to used when categorization of items is desired.
public IEnumerable CategorizedItemsSource { get; set; }
Property Value
- IEnumerable:
The items source to used when categorization of items is desired.
Remarks
Use this property instead of ItemsSource
when categorization of items is desired.
By setting this property, the ItemsSource
will be set to a view that supports categories and
the IsCategorized property will be set to true
.
CategoryTemplate
Gets or sets the DataTemplate to use for the display of categories.
public DataTemplate CategoryTemplate { get; set; }
Property Value
- DataTemplate:
The DataTemplate to use for the display of categories.
Remarks
This template is used when the IsCategorized property is true
.
FilterCategory
Gets or sets the category of items that is currently being filtered when CanFilter is true
.
public string FilterCategory { get; set; }
Property Value
Remarks
This property does nothing if CanFilter is false
or CategorizedItemsSource is null
.
When set to null
, no filtering will be performed and items in all categories will be displayed.
InitialColumnCount
Gets or sets the initial number of gallery item columns that are displayed when the popup appears.
public int InitialColumnCount { get; set; }
Property Value
- int:
The initial number of gallery item columns that are displayed when the popup appears. The default value is
1
.
IsCategorized
Gets whether the gallery is currently categorizing its items.
public bool IsCategorized { get; }
Property Value
- bool:
true
if the gallery is currently categorizing its items; otherwise,false
.
Remarks
This property will be set to true
if the CategorizedItemsSource property is set to an items source.
ItemCategoryDelegate
Gets or sets the optional delegate that can return an item's category, useful for MVVM support.
public Func<object, string> ItemCategoryDelegate { get; set; }
Property Value
- Func<object, string>:
The optional delegate that can return an item's category, useful for MVVM support.
Remarks
If the items are dependency objects, the attached Category
property can be directly set on them instead.
UseSingleColumn
Gets or sets whether the gallery's items are displayed in a single column.
public bool UseSingleColumn { get; set; }
Property Value
- bool:
true
if the gallery's items are displayed in a single column; otherwise,false
. The default value isfalse
.
Remarks
When this property is false
, items will fill in the available space horizontally before wrapping to the next line.
VerticalScrollBarVisibility
Gets or sets a value that indicates whether a vertical scrollbar should be displayed.
public ScrollBarVisibility VerticalScrollBarVisibility { get; set; }
Property Value
- ScrollBarVisibility:
A ScrollBarVisibility value that indicates whether a vertical scrollbar should be displayed. The default value is
Visible
.
Methods
GetCategorizedItemsSource()
Returns the IEnumerable that is the CategorizedItemsSource used to initialize a view for the ItemsSource
property.
protected virtual IEnumerable GetCategorizedItemsSource()
Returns
- IEnumerable:
The IEnumerable that is the CategorizedItemsSource used to initialize a view for the
ItemsSource
property.
GetCategory(DependencyObject)
Gets the value of the Category
attached property for a specified element.
public static string GetCategory(DependencyObject obj)
Parameter | Type | Description |
---|---|---|
obj | DependencyObject | The object from which the property value is read. |
Returns
- string:
The element's value.
OnScreenTipOpening(RoutedEventArgs)
Invoked when an unhandled ScreenTipOpening attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
protected override void OnScreenTipOpening(RoutedEventArgs e)
Parameter | Type | Description |
---|---|---|
e | RoutedEventArgs | A |
PrepareContainerForItemOverride(DependencyObject, object)
Prepares the specified element to display the specified item.
protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
Parameter | Type | Description |
---|---|---|
element | DependencyObject | The System.Windows.DependencyObject that is the wrapper element. |
item | object | The item that is being wrapped. |
SetCategory(DependencyObject, string)
Sets the value of the Category
attached property to a specified element.
public static void SetCategory(DependencyObject obj, string value)
Parameter | Type | Description |
---|---|---|
obj | DependencyObject | The object to which the attached property is written. |
value | string | The value to set. |
Fields
CanFilterProperty
Identifies the CanFilter dependency property. This field is read-only.
public static readonly DependencyProperty CanFilterProperty
CategorizedItemsSourceProperty
Identifies the CategorizedItemsSource dependency property. This field is read-only.
public static readonly DependencyProperty CategorizedItemsSourceProperty
CategoryProperty
Identifies the Category
dependency property. This field is read-only.
public static readonly DependencyProperty CategoryProperty
CategoryTemplateProperty
Identifies the CategoryTemplate dependency property. This field is read-only.
public static readonly DependencyProperty CategoryTemplateProperty
FilterCategoryProperty
Identifies the FilterCategory
dependency property. This field is read-only.
public static readonly DependencyProperty FilterCategoryProperty
InitialColumnCountProperty
Identifies the InitialColumnCount dependency property. This field is read-only.
public static readonly DependencyProperty InitialColumnCountProperty
IsCategorizedProperty
Identifies the IsCategorized dependency property. This field is read-only.
public static readonly DependencyProperty IsCategorizedProperty
ItemCategoryDelegateProperty
Identifies the ItemCategoryDelegate dependency property. This field is read-only.
public static readonly DependencyProperty ItemCategoryDelegateProperty
UseSingleColumnProperty
Identifies the UseSingleColumn dependency property. This field is read-only.
public static readonly DependencyProperty UseSingleColumnProperty
VerticalScrollBarVisibilityProperty
Identifies the VerticalScrollBarVisibility dependency property. This field is read-only.
public static readonly DependencyProperty VerticalScrollBarVisibilityProperty
Inherited Members
- GalleryBase.ActiveItemChangedEvent
- GalleryBase.ItemClickEvent
- GalleryBase.SelectedItemChangedEvent
- GalleryBase.ActiveItemProperty
- GalleryBase.IsPreviewEnabledProperty
- GalleryBase.IsSelectionHighlightVisibleProperty
- GalleryBase.ItemSizeProperty
- GalleryBase.SelectedItemProperty
- GalleryBase.ZoomedInItemTemplateProperty
- GalleryBase.ZoomedInItemTemplateSelectorProperty
- GalleryBase.CoerceCommandParameter(DependencyObject, object)
- GalleryBase.ExtractDataItem(object)
- GalleryBase.GetContainerForItemOverride()
- GalleryBase.IsItemItsOwnContainerOverride(object)
- GalleryBase.OnActiveItemChanged(object, object)
- GalleryBase.OnClick(ExecuteRoutedEventArgs)
- GalleryBase.OnItemClick(ObjectItemRoutedEventArgs)
- GalleryBase.OnItemTemplateChanged(DataTemplate, DataTemplate)
- GalleryBase.OnMouseLeave(MouseEventArgs)
- GalleryBase.OnSelectedItemChanged(object, object)
- GalleryBase.UpdateCanExecute()
- GalleryBase.ActiveItem
- GalleryBase.IsPreviewEnabled
- GalleryBase.IsSelectionHighlightVisible
- GalleryBase.ItemSize
- GalleryBase.SelectedItem
- GalleryBase.ZoomedInItemTemplate
- GalleryBase.ZoomedInItemTemplateSelector
- GalleryBase.ActiveItemChanged
- GalleryBase.ItemClick
- GalleryBase.SelectedItemChanged
- ItemsControlBase.ClickEvent
- ItemsControlBase.PreviewClickEvent
- ItemsControlBase.ScreenTipClosingEvent
- ItemsControlBase.ScreenTipOpeningEvent
- ItemsControlBase.CommandProperty
- ItemsControlBase.CommandParameterProperty
- ItemsControlBase.CommandTargetProperty
- ItemsControlBase.ContextProperty
- ItemsControlBase.HasImageProperty
- ItemsControlBase.HasLabelProperty
- ItemsControlBase.IdProperty
- ItemsControlBase.ImageSourceLargeProperty
- ItemsControlBase.ImageSourceSmallProperty
- ItemsControlBase.IsHighlightedProperty
- ItemsControlBase.KeyTipAccessTextProperty
- ItemsControlBase.LabelProperty
- ItemsControlBase.ScreenTipDescriptionProperty
- ItemsControlBase.ScreenTipFooterProperty
- ItemsControlBase.ScreenTipHeaderProperty
- ItemsControlBase.ScreenTipHelpUriProperty
- ItemsControlBase.ScreenTipImageSourceProperty
- ItemsControlBase.VariantSizeProperty
- ItemsControlBase.OnCommandChanged(ICommand, ICommand)
- ItemsControlBase.OnContextChanged(ControlContext, ControlContext)
- ItemsControlBase.OnCreateAutomationPeer()
- ItemsControlBase.OnItemsChanged(NotifyCollectionChangedEventArgs)
- ItemsControlBase.OnKeyTipAccessed(string)
- ItemsControlBase.OnPreviewClick(ExecuteRoutedEventArgs)
- ItemsControlBase.OnPropertyChanged(DependencyPropertyChangedEventArgs)
- ItemsControlBase.OnScreenTipClosing(RoutedEventArgs)
- ItemsControlBase.OnValidateItems(IList)
- ItemsControlBase.OnVariantSizeChanged(VariantSize, VariantSize)
- ItemsControlBase.RaiseClickEvent(ExecuteRoutedEventArgs)
- ItemsControlBase.CanUpdateCanExecuteWhenHidden
- ItemsControlBase.Command
- ItemsControlBase.CommandParameter
- ItemsControlBase.CommandTarget
- ItemsControlBase.Context
- ItemsControlBase.HasImage
- ItemsControlBase.HasLabel
- ItemsControlBase.Id
- ItemsControlBase.ImageSourceLarge
- ItemsControlBase.ImageSourceSmall
- ItemsControlBase.IsHighlighted
- ItemsControlBase.KeyTipAccessText
- ItemsControlBase.Label
- ItemsControlBase.ScreenTipDescription
- ItemsControlBase.ScreenTipFooter
- ItemsControlBase.ScreenTipHeader
- ItemsControlBase.ScreenTipHelpUri
- ItemsControlBase.ScreenTipImageSource
- ItemsControlBase.VariantSize
- ItemsControlBase.Click
- ItemsControlBase.PreviewClick
- ItemsControlBase.ScreenTipClosing
- ItemsControlBase.ScreenTipOpening