AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
24.98k stars 2.17k forks source link

Change in MultiBinding behaviour in 11.1.0-rc1 compared to 11.0.11 #16084

Closed mysticpillow closed 2 weeks ago

mysticpillow commented 2 months ago

Describe the bug

Manually calling ObservableObject.OnPropertyChanged(propertyName) does not trigger MultiBinding in 11.1.0-rc1 compared to 11.0.11. It still works after scrolling down to hide node from view and up to show again. Also works for child nodes after collapsing/expanding parent node.

To Reproduce

XAML code inside DataTemplate of TreeDataGrid column

<ContentControl.Content>
    <MultiBinding Converter="{x:Static converters:DataUseStateToIconConverter.Instance}">
        <Binding DataType="views:CustomTree" Path="#customTree" />
        <Binding DataType="models:TreeNode" Path="(models:TreeNode)" />
        <Binding DataType="models:TreeNode" Path="(models:TreeNode).DataUseStateUpdater"/>
    </MultiBinding>
</ContentControl.Content>

Code-behnid OnPropertyChanged(nameof(DataUseStateUpdater)); is called inside TreeNode model TreeNode is ObservableObject DataUseStateUpdater is ObservableProperty

Expected behavior

Calling OnPropertyChanged(propertyName) manually should trigger MultiBinding with a Binding to the property. Then converter should be used.

Avalonia version

11.1.0-rc1

OS

Windows

Additional context

No response

timunie commented 1 month ago

Please file a minimum sample to reproduce.

mysticpillow commented 1 month ago

A minimum repro: https://github.com/mysticpillow/MultiBindingRegressionRepro It uses a simple TextBlock instead of TreeDataGrid. Actually MultiBinding stopped working at 11.1.0-beta1 version.

mysticpillow commented 1 month ago

I think #16137 is closely related to this issue. In my example a MultiBinding converter (which is also custom) is used only once and then ignores following OnPropertyChanged calls in the same way.

grokys commented 1 month ago

Yep, this looks like the same issue as #16137 in that you're raising a PropertyChanged event on a property that hasn't changed, and expecting that to trigger a side-effect. My comment in https://github.com/AvaloniaUI/Avalonia/issues/16137#issuecomment-2192466488 also stands for this issue.

Given that these two issues have the same root cause I'm going to close this issue and track it in #16137.

grokys commented 1 month ago

Reopening this issue because although it has the same root cause as #16137, the fix for it is more difficult. I don't think a fix for this regression will make it into 11.1.0 as:

spacilv commented 1 week ago

It is still not working in version 11.1.3, MultiBinding is not revalidated.

timunie commented 1 week ago

@spacilv should be available in nightly or 11.2 as per https://github.com/AvaloniaUI/Avalonia/issues/16084#issuecomment-2196468378

spacilv commented 6 days ago

@spacilv should be available in nightly or 11.2 as per #16084 (comment)

Thank you, I missed that info. We have to wait for 11.2 then, current version 11.1.3 is unusable for us.