MaterialDesignInXAML / MaterialDesignInXAML/MaterialDesignInXamlToolkit

Hint Assist not disappearing when Text value is set on MaterialDesignDataGridTextColumnPopupEditingStyle

Open
#858 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug up-for-grabs
Dominant language
C#
Stars
16.3k
Forks
3.5k
Avg merge
1d 22h
Merged PRs (30d)
8

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with MaterialDataGridTextColumn, the MaterialDesignDataGridTextColumnPopupEditingStyle resource, and HintAssist.HintProperty as shown. Trace the TextBox hint behavior when editing begins with an existing value; done means the hint is hidden on re-entry while the value remains visible.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.