Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataGridNumericUpDownColumn foreground color #2434

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

DataGridNumericUpDownColumn foreground color #2434

GAMP opened this issue Mar 16, 2016 · 10 comments
Assignees
Labels
Milestone

Comments

@GAMP
Copy link

GAMP commented Mar 16, 2016

new bitmap image

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

@michaelmairegger
Copy link
Contributor

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

@GAMP
Copy link
Author

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.

@michaelmairegger
Copy link
Contributor

How is _right_aligned_header defined?

@GAMP
Copy link
Author

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>

@michaelmairegger
Copy link
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}

@punker76
Copy link
Member

@GAMP Is this still an issue for you?

@GAMP
Copy link
Author

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
Copy link

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
Copy link
Author

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
Copy link
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
Labels
Development

No branches or pull requests

3 participants