Back to Devexpress

BarManager.BarTemplateSelector Property

wpf-devexpress-dot-xpf-dot-bars-dot-barmanager-13a3cff1.md

latest2.7 KB
Original Source

BarManager.BarTemplateSelector Property

Gets or sets an object that chooses a template used to visualize objects stored as elements in the BarManager.BarsSource collection.

This is a dependency property.

Namespace : DevExpress.Xpf.Bars

Assembly : DevExpress.Xpf.Core.v25.2.dll

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public DataTemplateSelector BarTemplateSelector { get; set; }
vb
Public Property BarTemplateSelector As DataTemplateSelector

Property Value

TypeDescription
DataTemplateSelector

A System.Windows.Controls.DataTemplateSelector descendant that applies a template based on custom logic.

|

Remarks

To implement custom logic for choosing a template, create a System.Windows.Controls.DataTemplateSelector descendant, and override the System.Windows.Controls.DataTemplateSelector.SelectTemplate method. This method returns a data template for a specific object.

The BarTemplateSelector property supports the MVVM design pattern. See MVVM Support to learn more.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the BarTemplateSelector property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-bars-mvvm-generate-bars-from-view-model-collection/CS/DXSample/MainWindow.xaml#L76

xml
<Grid>
    <dxb:BarManager BarsSource="{Binding Bars}" BarTemplateSelector="{StaticResource BarTemplateSelector}"/>
</Grid>

See Also

BarTemplate

BarManager Class

BarManager Members

DevExpress.Xpf.Bars Namespace