Включить редактирование на месте для ячейки в GridControl

Я хотел бы включить редактирование на месте для ячеек в моем GridControl. Я установил свойство AllowEditing для TableView и Columns, но данные в моих ячейках по-прежнему не могут быть отредактированы после двойного щелчка по ячейке. В контекстном меню включено только "копировать". Мне не удалось найти решение.

Свойство NavigationStyle в TableView имеет значение «Ячейка».

Мой ксамл.

    <dx:PLinqInstantFeedbackDataSource x:Name="PLinqInstantFeedbackDataSource" ListSource="{Binding Path=TestCollectionSource}" DefaultSorting="Property1 ASC"/>
    <dxg:GridControl EnableSmartColumnsGeneration="True" ItemsSource="{Binding Path=Data, ElementName=PLinqInstantFeedbackDataSource}" SelectionMode="Cell" IsManipulationEnabled="True">
        <dxg:GridControl.View>
            <dxg:TableView AllowEditing="True" NavigationStyle="Cell" AllowFilterEditor="True" AlternateRowBackground="CornflowerBlue" ShowAutoFilterRow="True" />
        </dxg:GridControl.View>
        <dxg:GridControl.Columns>
            <dxg:GridColumn FieldName="Property1" AllowEditing="True" ReadOnly="False" />
            <dxg:GridColumn FieldName="Number" AllowEditing="True" ReadOnly="False" />
        </dxg:GridControl.Columns>
    </dxg:GridControl>

ИЗМЕНИТЬ

Класс ViewModel и ListSource

public class MainWindowViewModel : ObservableObject
{

    public MainWindowViewModel()
    {

    }

    private BindingList<TestClass> testCollection;
    public BindingList<TestClass> TestCollection
    {
        get
        {
            var result = this.testCollection;
            if (null == result)
            {
                lock(this)
                {
                    result = this.testCollection;
                    if (null == result)
                    {
                        result = new BindingList<TestClass>();
                        for (int i = 0; i < 1000000; i++)
                        {
                            result.Add(new TestClass() { Property1 = "test" + i, Number = i % 20 });
                        }

                        this.testCollection = result;
                    }
                }
            }
            return result;
        }
    }

    public IListSource TestCollectionSource
    {
        get { return new ListSource( ()=> this.TestCollection); }
    }
}
public class ListSource : IListSource
{
    public readonly Func<IList> innerListProvider;
    public ListSource(Func<IList> innerListProvider)
    {
        this.innerListProvider = innerListProvider;
    }
    public IList GetList()
    {
        return this.innerListProvider();
    }

    public bool ContainsListCollection
    {
        get { return false; }
    }
}

public class TestClass : ObservableObject
{
    private string property1;
    public string Property1
    {
        get { return this.property1; }
        set
        {
            this.property1 = value;
            RaisePropertyChanged(() => this.Property1);
        }
    }

    private int number;
    public int Number
    {
        get { return this.number; }
        set
        {
            this.number = value;
            RaisePropertyChanged(() => this.Number);
        }
    }
}

person Kapitán Mlíko    schedule 28.01.2015    source источник
comment
Является ли GridControl пользовательским DataGrid?   -  person Amit Raz    schedule 28.01.2015
comment
@AmitRaz GridControl — это DataGrid из библиотеки wpf от devexpress.   -  person Kapitán Mlíko    schedule 28.01.2015
comment
Какой у тебя TestCollectioSource? Можете ли вы предоставить код?   -  person nempoBu4    schedule 29.01.2015
comment
@nempoBu4 да. см. редактирование. Это очень просто. Мой xaml - это MainWindow. Я предоставил созданные мной классы MainWindowViewModel и ListSource.   -  person Kapitán Mlíko    schedule 29.01.2015
comment
Можете ли вы также добавить код для TestClass?   -  person nempoBu4    schedule 29.01.2015
comment
@nempoBu4 готово. ObservableObject — это реализация INotifyPropertyChanged.   -  person Kapitán Mlíko    schedule 29.01.2015


Ответы (1)


Я получил ответ от службы поддержки DevExpress.

PLinqInstantFeedbackDataSource — это источник данных, доступный только для чтения. Если вы хотите редактировать данные непосредственно в сетке, привяжите исходную коллекцию к свойству GridControl.ItemsSource без использования поставщика данных Instant Feedback.

person Kapitán Mlíko    schedule 29.01.2015