AvaloniaUtils / DialogHost.Avalonia

AvaloniaUI control that provides a simple way to display a dialog with information or prompt the user when information is needed
MIT License
228 stars 15 forks source link

DialogHostStyle.SetBorderThickness throws System.ArgumentException #52

Closed ExLuzZziVo closed 1 week ago

ExLuzZziVo commented 4 weeks ago

Setting BorderThickness using DialogHostStyle.SetBorderThickness method throws a System.ArgumentException. This is because the type of the value argument must be Thickness not double.

Steps to reproduce:

var dialogContent = new DialogContent();

DialogHost.Show(dialogContent, (o, args) =>
{
    if (o is DialogHost dialogHost)
    {
        DialogHostStyle.SetBorderThickness(dialogHost, 10);
    }
}, (o, args) =>
{
    //    
});

Exception details:

System.ArgumentException: Invalid value for Property 'BorderThickness': '10' (System.Double)
   at Avalonia.StyledProperty`1.ShouldSetValue(AvaloniaObject target, Object value, TValue& converted)
   at Avalonia.StyledProperty`1.RouteSetValue(AvaloniaObject target, Object value, BindingPriority priority)
   at Avalonia.AvaloniaObject.SetValue(AvaloniaProperty property, Object value, BindingPriority priority)
   at DialogHostAvalonia.DialogHostStyle.SetBorderThickness(DialogHost element, Double value)

This works:

dialogHost.SetValue(DialogHostStyle.BorderThicknessProperty, (object) new Thickness(10));
SKProCH commented 4 weeks ago

Hello, @ExLuzZziVo

Method void SetBorderThickness(DialogHost element, Thickness value) already accept only thickness as a value, I can't pass number:

image

ExLuzZziVo commented 4 weeks ago

Hi, @SKProCH

I'm using version 0.7.7 from nuget and this method accepts double: 2024-05-31 150721

SKProCH commented 3 weeks ago

Oh, I see. There is probably an issue with releases. I should rewrite the release process to handle this easily.

SKProCH commented 1 week ago

Fixed in last release