MaterialDesignInXAML / MaterialDesignInXamlToolkit

Google's Material Design in XAML & WPF, for C# & VB.Net.
http://materialdesigninxaml.net
MIT License
15.2k stars 3.44k forks source link

How to enter cell edit mode with a single click using DataGridTemplateColumn? #3722

Open charlesmz opened 2 weeks ago

charlesmz commented 2 weeks ago

Bug explanation

I have used DataGridTemplateColumn, but it doesn't enter edit mode with a single click like DataGridTextColumn does. How can I implement this feature?

<DataGridTemplateColumn Width="200" Header="{localization:Localize param_lab_pressurerange}">
    <DataGridTemplateColumn.CellTemplate>
        <DataTemplate>
            <TextBlock Style="{StaticResource MaterialDesignDataGridTextColumnStyle}" Text="{Binding Value}" />
        </DataTemplate>
    </DataGridTemplateColumn.CellTemplate>
    <DataGridTemplateColumn.CellEditingTemplate>
        <DataTemplate>
            <TextBox
                Style="{StaticResource MaterialDesignDataGridTextColumnEditingStyle}"
                Text="{Binding Value}" />
        </DataTemplate>
    </DataGridTemplateColumn.CellEditingTemplate>
</DataGridTemplateColumn>

Thanks

Version

4.5.0

JLdgu commented 2 weeks ago

The <DataGridTemplateColumn> is normally used for things like buttons, for your example above the <DataGridTextColumn> is the preferred option.

This question is not related to MaterialDesignInXAML but is a WPF question and should therefore be asked on somewhere like Stack Overflow

charlesmz commented 2 weeks ago

By default, the DataGridTextColumn is only a double click to enter the edit state, I used MaterialDesignInXAML and it can click to enter the edit state, but the DataGridTemplateColumn does not. How can I implement functionality like DataGridTextColumn