简体   繁体   English

如何在 WPF 数据网格单元格编辑模式下使用 myCustomTextBox 更改 TextBox

[英]How Change TextBox With myCustomTextBox in WPF datagrid cell editing mode

I need to change default TextBox With myCustomTextBox in WPF data grid cell editing mode.我需要在 WPF 数据网格单元格编辑模式下使用myCustomTextBox更改默认TextBox

For example: When a user doubleclick on a cell, Show MyCustomControl instead WPF TextBox.例如:当用户双击单元格时,显示 MyCustomControl 而不是 WPF TextBox。

Thanks.谢谢。

You can use a cellediting template like this enter code here您可以使用cellediting模板, 这样在此处输入代码

  <DataGrid ItemsSource="{Binding}">
        <DataGrid.Resources>
            <DataTemplate x:Key="CellEditingTemplate">
                <local:myCustomTextBox Text="{Binding PropertyName}"/>
            </DataTemplate>
        </DataGrid.Resources>
        <DataGridTemplateColumn CellEditingTemplate="{StaticResource CellEditingTemplate}"/>
</DataGrid>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM