KeldorKatarn
Topic Author
Posts: 193
Joined: 30 May 2014, 10:26

Default Styles and Generic.xaml in Unity

06 May 2021, 21:41

In standard WPF, when I create a new custom control, a few things happen:

[*]DefaultStyleKeyProperty metadata is overriden
[*]A style is added in Themes/Generic.xaml
[*]ThemeInfoAttribute is set on assembly level

In Unity this probably has to work differently? Unless AssemblyDefinitions are provided, basically everything will end up in the same assembly. And such an assemblyattribute could therefore be potentially specified multiple times, which would be bad.
What's the workflow for providing a control library in this way in Unity? Does it have to end up defining an AssemblyDefitinion or is there a way to make that also work along with other assets?
Come to think of it, what happens in Unity with XAML files that are inside an assembly definition scope anyway? Do the assets end up in that assembly or do they stay outside of it, or is the compiled class inside the assembly but the asset is outside of it or how does that work?
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: Default Styles and Generic.xaml in Unity

10 May 2021, 14:29

In Unity things are a bit different and so far we haven't explore more alternatives. Effectively for 3.1, we have plans to start providing our own .asmdef but I don't think that's gonna change anything, in fact there are already studios putting Noesis in a separate assembly.

In Unity, XAMLs are assets, so they cannot go inside assemblies. We don't have much control about it, but I assume we could use asset bundles to group. So for distributing your own control library in Unity, you would have to provide and assembly + a bundle. Inside the bundle you need to provide a resource dictionary that users must merge in the global dictionary.

We probably need to analyze this more carefully.
 
KeldorKatarn
Topic Author
Posts: 193
Joined: 30 May 2014, 10:26

Re: Default Styles and Generic.xaml in Unity

10 May 2021, 15:00

It's actually not THAT bad I think, since you'll probably override everything anyway in a game... I'm working on a sample at the moment.

Check my "feature/Conductors" sample branch in my github for Caliburn.Noesis. I added a few controls and work with them in new styling in the sample :)
You'll also see what I still need to make it work in Unity .)

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 65 guests