DialogHost.Avalonia icon indicating copy to clipboard operation
DialogHost.Avalonia copied to clipboard

Bug when mixing DialogContent and DataTemplates in a DialogHost instance in XAML ?

Open rodrigovaras opened this issue 2 years ago • 2 comments

Pretty sure this was working on previous versions of the nuget package. I moved to 0.7.7 and now i'm seeing a wrong popup when attempting to select the dialog content vs a data template. When using a data template using the 'Show' method then later attempting to select IsOpen shows the previous DataTemplate instead of the DialogContent. Here is the snippet of my XAML: <dialogHostAvalonia:DialogHost x:Name="DialogHost" IsOpen="{Binding CommandError, Converter={x:Static ObjectConverters.IsNotNull}}" Identifier="MainDialogHost" DialogClosingCallback="{Binding DialogClosingHandler}" DialogMargin="16" dialogHostAvalonia:DialogHostStyle.CornerRadius="8"> dialogHostAvalonia:DialogHost.DataTemplates <DataTemplate DataType="vm-iot:DownloadConfigurationModel"> <ContentControl Template="{StaticResource DownloadConfigurationControl}" /> </DataTemplate> <DataTemplate DataType="vm-iot:UploadConfigurationModel"> <ContentControl Template="{StaticResource UploadConfigurationControl}" /> </DataTemplate> <DataTemplate DataType="vm-iot:DownloadLogsModel"> <ContentControl Template="{StaticResource DownloadLogsControl}" /> </DataTemplate> </dialogHostAvalonia:DialogHost.DataTemplates>

    <dialogHostAvalonia:DialogHost.DialogContent>
        <StackPanel Orientation="Vertical">

.... When the binding trigger the IsOpen it will show a previous DataTenmplate used befaore. If no DataTemplate was used before then the behavior is to show the proper dialog content.

Can anybody confirm if this is a valid bug?

Thanks in advance,

rodrigovaras avatar Nov 03 '23 16:11 rodrigovaras

Hello, @rodrigovaras.

I was pretty sure what this is an Avalonia behavior. Can you provide an minimal reproduceable example, cuz i can't really understand order of actions tbh?

SKProCH avatar Nov 03 '23 20:11 SKProCH

Hello, @rodrigovaras.

I was pretty sure what this is an Avalonia behavior. Can you provide an minimal reproduceable example, cuz i can't really understand order of actions tbh?

XAML has defined a DataTemplate and a DialogContent section. I simulate an error during my 'Connect' command which will trigger the 'IsOpen' property. Result is correct the Host show the XAML content of my error description , etc.. So far good, now i use a menu item which trigger by code use the Show method that trigger the proper DataTemplate, i have 3 different ones. So far so good.

Finally i trigger another Connect error which should display my dialogcontent XAML, but it shows the latest XAML form the last DataTemplate.

rodrigovaras avatar Nov 03 '23 21:11 rodrigovaras

Closing as stale. If the issue still relevant - feel free to reopen this or create a new one.

SKProCH avatar Aug 21 '24 14:08 SKProCH