Skip to end of metadata
Go to start of metadata

Remarks

ISItemsControl is one of many available content model that Intersoft ClientUI provides. To learn more about other content model see Content Model Overview.

ISItemsControl is a base class for all ClientUI items controls. Controls that inherit from ISItemsControl contain a collection of objects. You can use either the ItemsSource property or the Items property to populate an ItemsControl.

The ItemsSource property of the ItemsControl enables you to use any type that implements IEnumerable as the content of the ItemsControl. ItemsSource is typically used to display a data collection or to bind an ItemsControl to a collection object.

To learn more how to bind data to ItemsSource property, see Walkthrough: Display data in UXListBox using MVVM Pattern.

If you do not want to use an object that implements IEnumerable to populate the ItemsControl, you can add items by using the Items property.

XAML

Styling and Templating

Each ItemsControl has a specific item type that represent the items of the ItemsControl. You can change the style / template of these items using ItemContainerStyle, ItemContainerStyleSelector, ItemTemplate and ItemTemplateSelector.

To learn more about styling and templating, see Styles and Templates Overview.

Working with ItemContainerStyle Property (ISItemsControl)

Styling using ItemContainerStyle property is the basic way to style the items of ItemsControl. As discussed above each ItemsControl has an item container type, you generally just need to provide the style of the item container type and assign it to ItemContainerStyle property.

The following example shows how to style the item of UXListBox using ItemContainerStyle property.

XAML

Working with ItemContainerStyleSelector Property

ItemContainerStyleSelector is used to perform certain validation before applying the style. This approach can be used to alternate style between items, or highlighting certain items based on certain condition and many other scenarios.

To use this approach you need to create a class that inherit from StyleSelector class.

The following example shows how to use StyleSelector to create alternate item style in UXListBox.

XAML
C#

Working with ItemTemplateSelector Property

Similar with ItemContainerStyleSelector, you can also create an ItemTemplateSelector by creating a class that inherit from DataTemplateSelector. This template selector allows you to apply different template on different item based on the logic describes in the template selector.

The following example shows how to use DataTemplateSelector to create alternate item template in UXListBox.

XAML

Definition

public abstract class ISItemsControl : ItemsControl,

IFramework, ILicensing, IDisposable, IItemsControl,

IControl

Summary

The following table summarizes the members exposed in this class.

Public Constructors

ISItemsControl Constructor()Initializes a new instance of ISItemsControl class.

Public Properties

CollectionMemberPathGets or sets the collection member path.
CornerRadiusRepresents the radius of a border's corner. The radius can't be negative.
FrameworkGets the entity framework.
GroupStyle 
ImageMemberPathGets or sets the image member path.
IsInDesignModeGets a value that indicates whether the control is in design mode (development).
IsRefreshingStyleGets a value that indicates whether the control's style is being refreshed or reassigned from style manager.
IsRefreshingTemplateGets a value that indicates whether the control's template is being refreshed or reassigned from template manager.
ItemContainerStyleGets or sets the Style that is applied to the container element generated for each item.
ItemContainerStyleSelectorGets or sets the Style Selector that is applied to the container element generated for each item.
ItemTemplateSelectorGets or sets the Template Selector that is applied to the container element generated for each item.
LayoutSuspendedGets a value that indicates whether the layout is being suspended.
PlatformGets a value that indicates the current client platform.

Protected Properties

ProductProduct Info.

Fields

CollectionMemberPathPropertyIdentifies the CollectionMemberPath dependency property.
CornerRadiusPropertyIdentifies the CornerRadius dependency property.
ImageMemberPathPropertyIdentifies the ImageMemberPath dependency property.
ItemBindEventIdentifies ItemBind routed event.
ItemBoundEventIdentifies ItemBoundEvent routed event.
ItemContainerStylePropertyIdentifies the ItemContainerStyle dependency property.
ItemContainerStyleSelectorProperty 
ItemTemplateSelectorProperty 

Public Methods

AttachEventHandlers()Attach built-in event handlers to control templates. Call this method if necessary.
ContainerFromIndex(int) 
ContainerFromItem(object) 
DetachedEventHandlers()Detach built-in event handlers from control templates. Call this method if necessary.
Dispose()Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
FindPanel()Gets the panel object reference.
FindPanels() 
GetItem(int) 
GetItemContainers() 
GetItems() 
GetItemsCount() 
IndexFromContainer(DependencyObject) 
IndexFromItem(object) 
InitializeStoryboards()Initializes storyboards.
InitializeTemplates()Initializes control templates.
ItemFromContainer(DependencyObject) 
OnApplyTemplate()Builds the visual tree for the ISItemsControl when a new template is applied.
RefreshClip()Perform clipping to the dimension of the control. Call this method if necessary
ResumeLayout()Resume the layout.
SuspendLayout()Suspend the layout.

Protected Methods

ApplyBinding(DependencyObject, object)Applies item binding for each generated element.
ApplyStyle(DependencyObject, object)Applies style for container element generated for each item.
ApplyTemplate(DependencyObject, object)Applies item template for each generated element.
IsItemItsOwnContainerOverride(object) 
OnCornerRadiusChanged(CornerRadius)Called when the value of CornerRadius property changes.
OnDependencyPropertyChanged(DependencyObject, DependencyPropertyChangedEventArgs)Invoked when the control properties has changed.
OnItemsChanged(NotifyCollectionChangedEventArgs) 
OnItemsPanelChanged(ItemsPanelTemplate, ItemsPanelTemplate)Called when the value of ItemsPanel property changes.
OnItemsSourceChanged(IEnumerable, IEnumerable)Called when the value of ItemsSource property changes.
OnUnloaded(object, RoutedEventArgs)Called when the element is unloaded.
PrepareContainerForItemOverride(DependencyObject, object)Prepares the specified element to display the specified item.
RefreshBinding(DependencyProperty, string)Refresh property binding.
RefreshImageBinding()Refresh image member path binding.
RefreshStyleSelector()Refresh style selector.
RefreshTemplateSelector()Refresh style selector.

Events

ItemBindOccurs when item binding.
ItemBoundOccurs when item is bound.

Public Constructors

public ISItemsControl()

Initializes a new instance of ISItemsControl class.

Public Properties

public string CollectionMemberPath { get; set; }

Gets or sets the collection member path.

public CornerRadius CornerRadius { get; set; }

Represents the radius of a border's corner. The radius can't be negative.

public ISFramework Framework { get; }

Gets the entity framework.

public ObservableCollection<GroupStyle> GroupStyle { get; }

 

public string ImageMemberPath { get; set; }

Gets or sets the image member path.

public bool IsInDesignMode { get; }

Gets a value that indicates whether the control is in design mode (development).

public bool IsRefreshingStyle { get; }

Gets a value that indicates whether the control's style is being refreshed or reassigned from style manager.

public bool IsRefreshingTemplate { get; }

Gets a value that indicates whether the control's template is being refreshed or reassigned from template manager.

public Style ItemContainerStyle { get; set; }

Gets or sets the Style that is applied to the container element generated for each item.

Remarks

Styling using ItemContainerStyle property is the basic way to style the items of ItemsControl. As discussed above each ISItemsControl has an item container type, you generally just need to provide the style of the item container type and assign it to ItemContainerStyle property.

 

public StyleSelector ItemContainerStyleSelector { get; set; }

Gets or sets the Style Selector that is applied to the container element generated for each item.

Remarks

ItemContainerStyleSelector is used to perform certain validation before applying the style. This approach can be used to alternate style between items, or highlighting certain items based on certain condition and many other scenarios. To use this approach you need to create a class that inherit from StyleSelector class.

 

public DataTemplateSelector ItemTemplateSelector { get; set; }

Gets or sets the Template Selector that is applied to the container element generated for each item.

Remarks

Similar with ISItemsControl, you can also create an ItemTemplateSelector by creating a class that inherit from DataTemplateSelector. This template selector allows you to apply different template on different item based on the logic describes in the template selector.

 

public bool LayoutSuspended { get; }

Gets a value that indicates whether the layout is being suspended.

public ClientPlatform Platform { get; }

Gets a value that indicates the current client platform.

Protected Properties

protected ProductInfo Product { get; }

Product Info.

Fields

public static readonly DependencyProperty CollectionMemberPathProperty

Identifies the CollectionMemberPath dependency property.

public static readonly DependencyProperty CornerRadiusProperty

Identifies the CornerRadius dependency property.

public static readonly DependencyProperty ImageMemberPathProperty

Identifies the ImageMemberPath dependency property.

public static readonly RoutedEvent ItemBindEvent

Identifies ItemBind routed event.

public static readonly RoutedEvent ItemBoundEvent

Identifies ItemBoundEvent routed event.

public static readonly DependencyProperty ItemContainerStyleProperty

Identifies the ItemContainerStyle dependency property.

public static readonly DependencyProperty ItemContainerStyleSelectorProperty

 

public static readonly DependencyProperty ItemTemplateSelectorProperty

 

Public Methods

public void AttachEventHandlers()

Attach built-in event handlers to control templates. Call this method if necessary.

public DependencyObject ContainerFromIndex(int index)

 

Parameters

index 

 

public DependencyObject ContainerFromItem(object item)

 

Parameters

item 

 

public void DetachedEventHandlers()

Detach built-in event handlers from control templates. Call this method if necessary.

public void Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public Panel FindPanel()

Gets the panel object reference.

Return Types

Panel

 

public IEnumerable FindPanels()

 

public object GetItem(int index)

 

Parameters

index 

 

public IEnumerable GetItemContainers()

 

public IEnumerable GetItems()

 

public int GetItemsCount()

 

public int IndexFromContainer(DependencyObject container)

 

Parameters

container 

 

public int IndexFromItem(object item)

 

Parameters

item 

 

public void InitializeStoryboards()

Initializes storyboards.

public void InitializeTemplates()

Initializes control templates.

public object ItemFromContainer(DependencyObject container)

 

Parameters

container 

 

public void OnApplyTemplate()

Builds the visual tree for the ISItemsControl when a new template is applied.

public void RefreshClip()

Perform clipping to the dimension of the control. Call this method if necessary

public void ResumeLayout()

Resume the layout.

public void SuspendLayout()

Suspend the layout.

Protected Methods

protected void ApplyBinding(DependencyObject element, object item)

Applies item binding for each generated element.

Parameters

elementContainer element.
itemItem.

 

protected void ApplyStyle(DependencyObject element, object item)

Applies style for container element generated for each item.

Parameters

elementContainer element.
itemItem.

 

protected void ApplyTemplate(DependencyObject element, object item)

Applies item template for each generated element.

Parameters

elementContainer element.
itemItem.

 

protected bool IsItemItsOwnContainerOverride(object item)

 

Parameters

item 

 

protected void OnCornerRadiusChanged(CornerRadius newRadius)

Called when the value of CornerRadius property changes.

Parameters

newRadiusThe new corner radius.

 

protected void OnDependencyPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)

Invoked when the control properties has changed.

Parameters

senderThe instance for which property is changed.
eThe event argument for DependencyPropertyChanged.

 

protected void OnItemsChanged(NotifyCollectionChangedEventArgs e)

 

Parameters

e 

 

protected void OnItemsPanelChanged(ItemsPanelTemplate oldValue, ItemsPanelTemplate newValue)

Called when the value of ItemsPanel property changes.

Parameters

oldValueThe old value of the ItemsPanel property.
newValueThe new value of the ItemsPanel property.

 

protected void OnItemsSourceChanged(IEnumerable oldValue, IEnumerable newValue)

Called when the value of ItemsSource property changes.

Parameters

oldValueThe old value of the ItemsSource property.
newValueThe new value of the ItemsSource property.

 

protected void OnUnloaded(object sender, RoutedEventArgs e)

Called when the element is unloaded.

Parameters

senderThe sender of the event.
eThe event data for the property change.

 

protected void PrepareContainerForItemOverride(DependencyObject element, object item)

Prepares the specified element to display the specified item.

Parameters

elementThe container element used to display the specified item.
itemThe item to display.

 

protected void RefreshBinding(DependencyProperty property, string propertyPath)

Refresh property binding.

Parameters

propertyDependency property.
propertyPathProperty path.

 

protected void RefreshImageBinding()

Refresh image member path binding.

protected void RefreshStyleSelector()

Refresh style selector.

protected void RefreshTemplateSelector()

Refresh style selector.

Events

public event DataBoundRoutedEventHandler ItemBind

Occurs when item binding.

public event DataBoundRoutedEventHandler ItemBound

Occurs when item is bound.

  • No labels