Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adonisUI:Space throw error #89

Closed
rasyidf opened this issue May 5, 2020 · 3 comments · Fixed by #105
Closed

adonisUI:Space throw error #89

rasyidf opened this issue May 5, 2020 · 3 comments · Fixed by #105
Labels
bug Something isn't working
Milestone

Comments

@rasyidf
Copy link

rasyidf commented May 5, 2020

Describe the bug
The SpaceExtension causes error

'' is not a valid value for the 'System.Windows.Controls.Control.Padding' property on a Setter.

and make the WPF designer stopped working.

Reproduce

It's just randomly appear in designer. like this.
image

Additional context
I've resolved some of error this by adding this piece of code in App.xaml.cs:

protected override void OnStartup(StartupEventArgs e)
{
    base.OnStartup(e);
    AdonisUI.SpaceExtension.SetSpace(8, 8);
}

but still, it's not the solution right?

Is there any Fallback value for the SpaceExtension if something's not right?

@rasyidf rasyidf added the bug Something isn't working label May 5, 2020
@benruehl
Copy link
Owner

benruehl commented May 8, 2020

So it seems like the designer fails to evaluate this statement in the default style of ScrollViewer:

<Setter Property="Padding" Value="{adonisUi:Space 0.5}"/>

I don't know why it fails here. Interesting that your call of SetSpace(8, 8) makes it work.

Before I take a deeper look at this, can you please make sure that you are using the current version of Visual Studio with the latest XAML Designer?
The designer received a major update a few months ago which might eliminate this issue.

@rasyidf
Copy link
Author

rasyidf commented May 9, 2020

I'm using 2 Version, the current Community Edition 16.5.4, and the Preview 3 Edition 16.6. both of them raise same problem

yes, I think the new designer is broken, and unfortunately there's no option to use legacy designer.

@benruehl
Copy link
Owner

benruehl commented Jun 17, 2020

I experimented a lot with the SpaceExtension but whenever I had a promising idea it turned out to have no effect on the errors. I was able to reproduce the exact same error you got but sometimes it just disappeared after changing absolutely nothing.

So I still have no clue what causes the error.

But I found out that changing

<Setter Property="Padding" Value="{adonisUi:Space 0.5}"/>

to

<Setter Property="Padding" Value="{adonisUi:Space 0.5, 0.5}"/>

... seemed to make the error disappear. Although the error sometimes did not re-appear when reverting this change. It's crazy, I know.

So I created a PR for this and we will see in the next release if it changes anything for you.

The PR contains another change as well that made sense to me but seemed to not have any effect. I included it anyways because it does no harm and might be useful to prevent similar errors.

I am not really satisfied with this solution but currently it is the best I have. Let's see how it performs. Feel free to re-open this issue when v1.16.0 is out in case you still receive the error.

@benruehl benruehl added this to the 1.16 milestone Jun 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants