Bound Hint text not updating #3370
Replies: 2 comments 1 reply
-
@GeoffEngelstein Could you please share a bit more context? I just tested out binding the Please paste a bit more XAML, and also a bit more of the view model / code-behind you're using. |
Beta Was this translation helpful? Give feedback.
-
Thanks. Here is some more info. This is for a To/From user control that gets placed into a search form, made from two text boxes. <TextBox Grid.Column="0"
Foreground="Black"
Margin="0,3,3,0"
Text="{Binding ElementName=Root, Path=FromInternal, UpdateSourceTrigger=PropertyChanged}"
Width="150"
Style="{StaticResource MaterialDesignFilledTextBox}"
materialDesign:HintAssist.Hint="{Binding ElementName=Root, Path=HintFrom}"
/>
<TextBox Grid.Column="1"
Foreground="Black"
Text="{Binding ElementName=Root, Path=ToInternal, UpdateSourceTrigger=PropertyChanged, Mode=OneWay}"
Margin="0,3,3,0"
Width="150"
Style="{StaticResource MaterialDesignFilledTextBox}"
materialDesign:HintAssist.Hint="{Binding ElementName=Root, Path=HintTo, Mode=OneWay}"
/> When one of the textboxes changes, it updates the backing field, which also checks to see if the Hint should be updated: public string FromInternal
{
get => _fromInternal;
set { _fromInternal = value;
UpdateValues();
ChangeHintPrompts();
OnPropertyChanged(); }
} ChangeHintPrompts looks like this: private void ChangeHintPrompts()
{
HintTo = $"To{AnyString(ToInternal)}";
HintFrom = $"From{AnyString(FromInternal)}";
} and HintTo and HintFrom are (now) just standard backing properties. public string HintFrom
{
get => _hintFrom;
set { _hintFrom = value; OnPropertyChanged(); }
} I've put a breakpoint on OnPropertyChanged and it is definitely firing with the "HintFrom" and "HintTo" parameters. But the Hint text in the control never changes. After "OnPropertyChanged" the getters for HintFrom and HintTo are not called. There are no issues noted in the XAML Binding Failures window. Apologies for the lack of line breaks in the code. Not sure how to add that in there. |
Beta Was this translation helpful? Give feedback.
-
I have hint text in a textbox (using HintAssist) that I would like to change based on the contents of the textbox. I'm using the floating hint that tucks up into the upper left when there is something in the box.
The xaml is:
materialDesign:HintAssist.Hint="{Binding ElementName=Root, Path=HintTo, Mode=OneWay}"
In the code behind I am doing:
OnPropertyChanged(nameof(HintTo));
which is being executed. However the hint text doesn't change. I put a breakpoint on the HintTo property and it doesn't get hit.
Suggestions?
Beta Was this translation helpful? Give feedback.
All reactions