From WPF to Avalonia
Hey, i have a little question that somebody might know the solution to. Or a different way of dealing with it.
So basically we created a WPF application, and we are not turning it in to an Avalonia application instead because we want it to be multiplatform.
For this we thought we would have both WPF and Avalonia up and running at the same time while we are moving everything over. This works and makes it moving over really easy.
However, Rider's intelligence in the xaml files are wrong.
Basically when coding in a WPF application, it gives WPF intelligence
When coding a Avalonia app, it gives Avalonia intelligence
But now that we have both, it gives WPF intelligence, for both the Avalonia files and the WPF files.
Is there a way to for example switch the intelligence to focus prioritize Avalonia instead of WPF or something?
17 Replies
Just for extra info.
The red error lines, and the yellow warning lines are all fake.
The project builds just fine and it all works
What do you mean by 'intelligence'?
Are these views in the same project? Different projects?
Basically the tab-complete, And when it knows when something will result in a compilation error (aka the red lines). Things like that
However, for example here, It is saying that BackgroundColor is the wrong type. This is because it things i am refering ot the Background Color in the WPF styles. But no, i am instead refering to the Avalonia styles. and so that is correct.
And the compiler knows that just fine, but my editor doesnt 🤷♂️
The same project. Together in to 1 project (but that is temporary)
I wouldn't port that way. I'd create a separate Avalonia project and bring the WPF views in piece-by-piece.
Avalonia does have the capability to host WPF (or vice-versa) if you go out of your way to look at how to do it, but it's not a standard feature.
I think those examples still used project isolation.
so in short, you are saying it is impossible to accomplish what i want here, unless if i would make my own modifications of some sorts to the editor like plugins or something?
which would be fair enough btw
Yea, however, the problem a bit is that my computer is not so strong, and so running 2 editors is... anoying.... lol
Or constantly swapping between branch/version/repo is also anoying
And also, its also the entire backend that i want to keep
It seems like too niche of a scenario for JetBrains to add specific support for, but you could always open a ticket for them to see if there are any mitigations.
haha, yea no i am not even going to try. I am probably the only one in the next 5 years that is dealing with this issue
I don't mean different solution, I mean different project. ie. YourApp.Wpf and YourApp.AvaloniaUI in the same solution.
That's how I did my last port, but that was approx 2 years ago and in VS.
does that mean we can keep the backend code? or do we have to duplicate the backend code. Since that is what i am a bit affraid of
Is the backend code in its own project?
nope
That's a pretty big architectural flaw to have backend/domain side-by-side with your GUI app.
I keep saying backend, but idk if its really backend.
Its just the business logic that has nothing to do with the actual GUI framework
Isolating it into its own reusable project (within the same solution) is best. If you can't do that, then the best you can do is: 1. create separate Avalonia project. 2. reference business + WPF project from it. 3. hope that the isolation works.
4. Once ported, then remove WPF stuff from the WPF project. And move business logic into its own project as its essentially isolated at this point.
If the plan is to keep the WPF client for some time, then you really want to isolate the business logic first, IMO.
aha yes okay, that makes a lot of sence
thanks a lot