uno.extensions icon indicating copy to clipboard operation
uno.extensions copied to clipboard

[MVUX] PropertyChanged event not being raised at root level of generated Bindable entities

Open kazo0 opened this issue 1 year ago • 0 comments

Given the following Model and Entity:

public partial record MainModel
{
    private INavigator _navigator;

    public MainModel(
        INavigator navigator)
    {
        _navigator = navigator;
        Title = "Main";
    }

    public string? Title { get; }

    public IState<Entity> Entity => State<Entity>.Value(this, () => new("Steve"));

}

public record Entity(string Name)
{
    public string NameToUpper => Name.ToUpperInvariant();
}

And the following XAML

<StackPanel HorizontalAlignment="Center"
			VerticalAlignment="Center"
			Spacing="16">
	<TextBox Text="{Binding Entity.Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
			 Header="Entity.Name"
			 PlaceholderText="Enter your name:" />
	<TextBox Text="{Binding Entity.Value.Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
			 Header="Entity.Value.Name"
			 PlaceholderText="Enter your name:" />
	<TextBlock>
		<Run Text="Binding Entity.NameToUpper = " />
		<Run Text="{Binding Entity.NameToUpper}" />
	</TextBlock>
	<TextBlock>
		<Run Text="Binding Entity.Value.NameToUpper = " />
		<Run Text="{Binding Entity.Value.NameToUpper}" />
	</TextBlock>
</StackPanel>

I would expect the Binding Entity.NameToUpper to react to the TextBox changes but only the TextBlock with Binding Entity.Value.NameToUpper is properly updated

https://github.com/unoplatform/uno.extensions/assets/4793020/db7cffc0-e76a-4213-963e-18a41071ceed

UnoApp54.zip

kazo0 avatar Jun 25 '24 13:06 kazo0