Intersoft ClientUI Documentation
CellEditingTemplateSelector Property
See Also  Send Feedback
Intersoft.Client.UI.Data Namespace > UXGridView Class : CellEditingTemplateSelector Property






Gets or sets the template selector that is used to display the contents of a cell that is in editing mode.

Syntax

Visual Basic (Declaration) 
Public Property CellEditingTemplateSelector As DataTemplateSelector
Visual Basic (Usage)Copy Code
Dim instance As UXGridView
Dim value As DataTemplateSelector
 
instance.CellEditingTemplateSelector = value
 
value = instance.CellEditingTemplateSelector
C# 
public DataTemplateSelector CellEditingTemplateSelector {get; set;}
Delphi 
public read-write property CellEditingTemplateSelector: DataTemplateSelector; 
JScript 
public function get,set CellEditingTemplateSelector : DataTemplateSelector
Managed Extensions for C++ 
public: __property DataTemplateSelector* get_CellEditingTemplateSelector();
public: __property void set_CellEditingTemplateSelector( 
   DataTemplateSelector* value
);
C++/CLI 
public:
property DataTemplateSelector^ CellEditingTemplateSelector {
   DataTemplateSelector^ get();
   void set (    DataTemplateSelector^ value);
}

Example

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}">

Remarks

A rather unique scenario is where the users would like to have different editing control for the same column that depends on the data that currently being edited. This can be achieved elegantly in UXGridView by using CellEditingTemplateSelector. It works similarly to any other template selectors.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2012 All Rights Reserved.