question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hint Assist not disappearing when Text value is set on MaterialDesignDataGridTextColumnPopupEditingStyle

See original GitHub issue

I am creating dynamic columns for my DataGrid, so I am creating a number of MaterialDataGridTextColumn in code behind. I am modifying the MaterialDesignDataGridTextColumnPopupEditingStyle to allow the TextBox to have a hint property:

Style style = (Style)FindResource("MaterialDesignDataGridTextColumnPopupEditingStyle");
var editingStyle = new Style(typeof(TextBox), style)
{
	Setters =
	{
		new Setter(HintAssist.HintProperty, "Enter Score"),
		new Setter(MarginProperty, new Thickness(8)),
	}
};

foreach (string name in columnNames)
{
	var binding = new Binding("Attributes[" + name + "].Value")
	{
		UpdateSourceTrigger = UpdateSourceTrigger.LostFocus,
		ValidatesOnDataErrors = true,
		StringFormat = "0.0;;#"
	};

	var mdTxtCol = new MaterialDataGridTextColumn
	{
		Header = name,
		Binding = binding,
		EditingElementStyle = editingStyle,
		ElementStyle = centerTextSetter,
	};
	caseGrid.Columns.Add(mdTxtCol);
}

This successfully produces the pop up like so:

image

And as you type a value in the textbox, the hint property disappears, as it should:

image

However, the problem is that when this cell re-enters the edit mode while it contains a value, the hint property should disappear, but it doesn’t:

image

As you can see, both the entered value and the hint property are shown.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jcummings2commented, Jun 25, 2019

I am experiencing this problem as well, although I am setting the Hint in XAML. It is easy to reproduce the issue with the Demo program by altering the EditingElementStyle of the Name column as follows:

<materialDesign:MaterialDataGridTextColumn Binding="{Binding Name}"
                                       Header="Name"
                                       >
        <materialDesign:MaterialDataGridTextColumn.EditingElementStyle>
            <Style BasedOn="{StaticResource MaterialDesignDataGridTextColumnPopupEditingStyle}" TargetType="{x:Type TextBox}" >
                <Setter Property="materialDesign:HintAssist.Hint" Value="Name Hint" />
            </Style>
        </materialDesign:MaterialDataGridTextColumn.EditingElementStyle>
</materialDesign:MaterialDataGridTextColumn>

This leads to the behavior @AmitBhatnagar24 noted previously. Here is a screencast illustrating the problem:

material-design-datagrid-editor-hint-bug

Note that the Hint disappears when typing anything in the box. It reappears, however, when selecting the cell again.

I believe the XAML is adding setters not replacing the entire set, so I think it avoids the issue that @Keboo mentioned.

0reactions
jcummings2commented, Jun 25, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to disappear the hint in TextInputEditText on receiving ...
Try to set focus change listener on EditText and hide hint programmatically when focus is true and show again hint if focus is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found