DataGridNumericUpDownColumn foreground color #2434

Closed
GAMP opened this Issue Mar 16, 2016 · 10 comments

Comments

Projects
None yet
4 participants
@GAMP

GAMP commented Mar 16, 2016

new bitmap image

When selected font color is not changed as on other text elements.

@xxMUROxx

This comment has been minimized.

Show comment
Hide comment
@xxMUROxx

xxMUROxx Mar 17, 2016

Contributor

Which version of MahApps do you use.
Can you show us the XAML code that reproduces the problem.

Contributor

xxMUROxx commented Mar 17, 2016

Which version of MahApps do you use.
Can you show us the XAML code that reproduces the problem.

@GAMP

This comment has been minimized.

Show comment
Hide comment
@GAMP

GAMP Mar 17, 2016

<ma:DataGridNumericUpDownColumn
    Header="{lex:Loc Key=QTY}"
    Minimum="1"
    Binding="{Binding Quantity,UpdateSourceTrigger=PropertyChanged,StringFormat=N2}"
    HeaderStyle="{StaticResource _right_aligned_header}">
    <ma:DataGridNumericUpDownColumn.CellStyle>
        <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
            <Setter Property="ma:NumericUpDown.IsReadOnly" Value="{Binding IsBundleProduct}"/>
        </Style>
    </ma:DataGridNumericUpDownColumn.CellStyle>
</ma:DataGridNumericUpDownColumn>

Using latest source.

GAMP commented Mar 17, 2016

<ma:DataGridNumericUpDownColumn
    Header="{lex:Loc Key=QTY}"
    Minimum="1"
    Binding="{Binding Quantity,UpdateSourceTrigger=PropertyChanged,StringFormat=N2}"
    HeaderStyle="{StaticResource _right_aligned_header}">
    <ma:DataGridNumericUpDownColumn.CellStyle>
        <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
            <Setter Property="ma:NumericUpDown.IsReadOnly" Value="{Binding IsBundleProduct}"/>
        </Style>
    </ma:DataGridNumericUpDownColumn.CellStyle>
</ma:DataGridNumericUpDownColumn>

Using latest source.

@xxMUROxx

This comment has been minimized.

Show comment
Hide comment
@xxMUROxx

xxMUROxx Mar 17, 2016

Contributor

How is _right_aligned_header defined?

Contributor

xxMUROxx commented Mar 17, 2016

How is _right_aligned_header defined?

@GAMP

This comment has been minimized.

Show comment
Hide comment
@GAMP

GAMP Mar 17, 2016

<DataGrid.Resources>
    <Style x:Key="_right_aligned_header" TargetType="DataGridColumnHeader" BasedOn="{StaticResource MetroDataGridColumnHeader}">
        <Setter Property="HorizontalContentAlignment" Value="Right" />
    </Style>
    <Style x:Key="_left_aligned_header" TargetType="DataGridColumnHeader" BasedOn="{StaticResource MetroDataGridColumnHeader}">
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
    </Style>
</DataGrid.Resources>

GAMP commented Mar 17, 2016

<DataGrid.Resources>
    <Style x:Key="_right_aligned_header" TargetType="DataGridColumnHeader" BasedOn="{StaticResource MetroDataGridColumnHeader}">
        <Setter Property="HorizontalContentAlignment" Value="Right" />
    </Style>
    <Style x:Key="_left_aligned_header" TargetType="DataGridColumnHeader" BasedOn="{StaticResource MetroDataGridColumnHeader}">
        <Setter Property="HorizontalContentAlignment" Value="Left"/>
    </Style>
</DataGrid.Resources>
@xxMUROxx

This comment has been minimized.

Show comment
Hide comment
@xxMUROxx

xxMUROxx Mar 18, 2016

Contributor

Ok, the error is in following code:

<Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
  <Setter Property="ma:NumericUpDown.IsReadOnly" Value="{Binding IsBundleProduct}"/>
</Style>

Just change {StaticResource {x:Type DataGridCell}} with {StaticResource MetroDataGridCell}

Contributor

xxMUROxx commented Mar 18, 2016

Ok, the error is in following code:

<Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
  <Setter Property="ma:NumericUpDown.IsReadOnly" Value="{Binding IsBundleProduct}"/>
</Style>

Just change {StaticResource {x:Type DataGridCell}} with {StaticResource MetroDataGridCell}

@punker76

This comment has been minimized.

Show comment
Hide comment
@punker76

punker76 Apr 14, 2016

Member

@GAMP Is this still an issue for you?

Member

punker76 commented Apr 14, 2016

@GAMP Is this still an issue for you?

@GAMP

This comment has been minimized.

Show comment
Hide comment
@GAMP

GAMP Apr 14, 2016

<ma:DataGridNumericUpDownColumn.CellStyle>
                            <Style BasedOn="{StaticResource MetroDataGridCell}" TargetType="DataGridCell">
                                <Setter Property="ma:NumericUpDown.IsReadOnly" Value="{Binding IsBundleProduct}" />
                            </Style>
                        </ma:DataGridNumericUpDownColumn.CellStyle>

Did not resolve the problem. Foreground still remains black when row is selected.

GAMP commented Apr 14, 2016

<ma:DataGridNumericUpDownColumn.CellStyle>
                            <Style BasedOn="{StaticResource MetroDataGridCell}" TargetType="DataGridCell">
                                <Setter Property="ma:NumericUpDown.IsReadOnly" Value="{Binding IsBundleProduct}" />
                            </Style>
                        </ma:DataGridNumericUpDownColumn.CellStyle>

Did not resolve the problem. Foreground still remains black when row is selected.

@reduckted

This comment has been minimized.

Show comment
Hide comment
@reduckted

reduckted May 21, 2016

It seems that the default style of the NumericUpDown control is taking precedence when the row is selected.

Here's what Snoop shows for a cell in a normal DataGridTextColumn when the row is selected:
image

And here's what Snoop shows for a cell in a DataGridNumericUpDownColumn when the row is selected:
image

I'll keep poking around and see what if I can find a way to get the Foreground value to be inherited.

It seems that the default style of the NumericUpDown control is taking precedence when the row is selected.

Here's what Snoop shows for a cell in a normal DataGridTextColumn when the row is selected:
image

And here's what Snoop shows for a cell in a DataGridNumericUpDownColumn when the row is selected:
image

I'll keep poking around and see what if I can find a way to get the Foreground value to be inherited.

@GAMP

This comment has been minimized.

Show comment
Hide comment
@GAMP

GAMP Aug 5, 2016

Still an issue

GAMP commented Aug 5, 2016

Still an issue

@punker76 punker76 added the Bug label Sep 20, 2016

@punker76 punker76 added this to the 1.4.0 milestone Sep 20, 2016

@punker76 punker76 self-assigned this Sep 20, 2016

@punker76 punker76 modified the milestones: 1.5.0, 1.4.0 Dec 21, 2016

@punker76 punker76 closed this in 67dca0a Apr 8, 2017

@punker76

This comment has been minimized.

Show comment
Hide comment
@punker76

punker76 Apr 8, 2017

Member

@GAMP It's never too late to fix Issues :-D This is now fixed and available in 1.5.0

Member

punker76 commented Apr 8, 2017

@GAMP It's never too late to fix Issues :-D This is now fixed and available in 1.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment