How to restore DataGridTextColumn text field?

I am working with a Wpf application. I created my own style for wpf DataGrid(presented in the Wpf Toolkit). All this works fine, except that I cannot apply Styleto TextBox, which appears when I double-click on a cell (editable mode) in DataGridTextColumn. It displays as the default style and does not match my style and looks weird. I applied the style to ComboBoxin DataGridComboBoxColumnand CheckBoxall other controls, but this one doesn't work. Any help plz !!!

Edit:

I have a control library, and each control is redefined here for tuning (additional functionality) and restyling. These controls are used through the application. I have to apply this style to the control in the control library. So that I can reflect this in my application.

+3
source share
1 answer

Not perfect, but it works ...

<Style x:Key="DataGridTextBoxStyle"
    TargetType="TextBox">
    <Setter
        Property="SelectionBrush"
        Value="#FFF8D172" />
    <Setter
        Property="Padding"
        Value="0" />
    <Setter
        Property="VerticalContentAlignment"
        Value="Center" />
    <Setter
        Property="FontSize"
        Value="9pt" />
    <Setter
        Property="SelectionOpacity"
        Value="0.6" />
</Style>

<DataGridTextColumn
   x:Name="TextColumn"
   Header="Header"
   EditingElementStyle="{StaticResource ResourceKey=DataGridTextBoxStyle}"/>
+5
source

Source: https://habr.com/ru/post/1789759/


All Articles