Intersoft.Client.UI.Data Namespace > UXGridView Class : CellEditingTemplateSelector Property |
Public Property CellEditingTemplateSelector As DataTemplateSelector
Dim instance As UXGridView Dim value As DataTemplateSelector instance.CellEditingTemplateSelector = value value = instance.CellEditingTemplateSelector
public DataTemplateSelector CellEditingTemplateSelector {get; set;}
public: property DataTemplateSelector^ CellEditingTemplateSelector { DataTemplateSelector^ get(); void set ( DataTemplateSelector^ value); }
The following code shows how to create the editing template selector and used it in UXGridView.
Cell Editing Template Selector |
Copy Code
|
---|---|
using System.Windows; using Intersoft.Client.Framework; using Intersoft.Client.UI.Data; namespace UXGridView.Samples.Selectors { public class CellEditingSelector: DataTemplateSelector { public DataTemplate NumericEditor { get; set; } public DataTemplate SliderEditor { get; set; } public override DataTemplate SelectTemplate(object item, DependencyObject container) { UXGridViewCell cell = container as UXGridViewCell; UXGridViewRowBase rowBase = cell.OwningRowBase; UXGridViewRow row = rowBase as UXGridViewRow; switch (cell.OwningColumn.PropertyName) { case "UnitsInStock": if (rowBase.IsNewRow || (row != null && row.Index % 2 != 0)) return this.SliderEditor; else return this.NumericEditor; } return null; } } } |
View |
Copy Code
|
---|---|
<Grid.Resources> <DataTemplate x:Key="NumericEditor"> <Intersoft:UXNumericUpDown Maximum="100" Value="{Binding UnitsInStock, Mode=TwoWay}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/> </DataTemplate> <DataTemplate x:Key="SliderEditor"> <Intersoft:UXSliderBar Value="{Binding UnitsInStock, Mode=TwoWay}" SmallChange="10" LargeChange="20" Maximum="100"/> </DataTemplate> <Selectors:CellEditingSelector x:Key="CellEditingSelector" NumericEditor="{StaticResource NumericEditor}" SliderEditor="{StaticResource SliderEditor}"/> </Grid.Resources> <Intersoft:UXGridView CellEditingTemplateSelector="{StaticResource CellEditingSelector}"> |
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2