Skip to content

Docs(theme service): add mvux state using sample - #2749

Open
DevTKSS wants to merge 15 commits into
unoplatform:mainfrom
DevTKSS:docs(ThemeService)-Add-mvux-State-using-Sample
Open

DevTKSS wants to merge 15 commits into
unoplatform:mainfrom
DevTKSS:docs(ThemeService)-Add-mvux-State-using-Sample

Conversation

@DevTKSS

@DevTKSS DevTKSS commented Apr 30, 2025

Copy link
Copy Markdown
Contributor

GitHub Issue (If applicable): closes #

PR Type

What kind of change does this PR introduce?

  • Documentation content changes

What is the current behavior?

Only Mvvm sample but none for State binding commonly used in MVUX Applications

What is the new behavior?

Added sample to documentation to show how it can be done in a mvux app

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs => Works fine at my SkiaDesktop target app
  • Docs have been added/updated which fit documentation template. (for bug fixes / features)
  • Unit Tests and/or UI Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Wasm UI Tests are not showing unexpected any differences. Validate PR Screenshots Compare Test Run results.
  • Contains NO breaking changes
  • Updated the Release Notes
  • Associated with an issue (GitHub or internal) => Has been asked at Discord few days ago

Other information

Internal Issue (If applicable):

Comment on lines +96 to +97
> [!NOTE]
> In case, you try to bind a `CommandExtension.Command` to a ToggleSwitch, you will need to use the `IsOn` property to bind it, because `Toggled` Behaviour is not triggering the `CommandExtensions.Command`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this part, I think we should add this functionality to the CommandExtensions. Issue created here: unoplatform/uno.toolkit.ui#1391

We don't need to call this out here so I think we can remove this NOTE

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kazo0 does removing this note mean, to also remove the IsOn Property Binding? I could consider a way that might be a usecase for BindBack but I honestly do not know how to use that correctly same as the FallbackValue or TargetNullValue (e.g. considered this for workaround the roslyn issue.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed note in b55486c Replaced as comment to be applyed after fixing this issues

}
```

### [MVUX](#tab/mvux)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that ThemeChangedMessage in there is quite cool and the ISettingsService... Can we not get a SettingsService generally available in extensions? that would really be cool! to have just to call this to automatically switch theme or localization! is this think-able?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kazo0 might gone under, but do you have some answer to that asked question?
And I am not sure if I would fully agree to move EVERY How-To use to the Chefs. This doc page here I think would be the basical start point for those who are finding the ThemeService. So as every Uno App does also let us choose, on which base we want to build -> Mvvm OR Mvux , from my opinion, there should also be that basical How to guide thats reflecting this both basic implementations and not only Mvvm! So just given szenario, I am a new Developer not having a deeper knowledge of this differences and only having the mvvm sample here, I did indeed have myself the constant problem, that 80% of the Uno docs giving samples for only Mvvm (except the mvux exclusive docs) but missing mvux. that makes it much more difficult to start and develop with uno when I might not want to learn before the whole mvvm things.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kazo0 Might have slipped through the cracks. I am still looking for an answer to this, would you mind...?

Copilot AI review requested due to automatic review settings September 23, 2025 16:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds MVUX state binding examples to the ThemeService documentation, expanding beyond the existing MVVM examples. The documentation now provides developers with guidance on how to implement theme switching in MVUX applications using state binding patterns.

  • Adds MVUX tab section with Model and View examples showing state-based theme binding
  • Includes practical code samples for implementing theme switching with IState and ToggleSwitch
  • Updates source code link format to use markdown code syntax

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

}
```

### [MVUX](#tab/mvux)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kazo0 might gone under, but do you have some answer to that asked question?
And I am not sure if I would fully agree to move EVERY How-To use to the Chefs. This doc page here I think would be the basical start point for those who are finding the ThemeService. So as every Uno App does also let us choose, on which base we want to build -> Mvvm OR Mvux , from my opinion, there should also be that basical How to guide thats reflecting this both basic implementations and not only Mvvm! So just given szenario, I am a new Developer not having a deeper knowledge of this differences and only having the mvvm sample here, I did indeed have myself the constant problem, that 80% of the Uno docs giving samples for only Mvvm (except the mvux exclusive docs) but missing mvux. that makes it much more difficult to start and develop with uno when I might not want to learn before the whole mvvm things.

}
```

### [MVUX](#tab/mvux)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kazo0 Might have slipped through the cracks. I am still looking for an answer to this, would you mind...?

## Source Code

[ThemeService Implementation](https://github.com/unoplatform/uno.extensions/blob/51c9c1ef14f686363f946588733faecc5a1863ff/src/Uno.Extensions.Core.UI/Toolkit/ThemeService.cs)
[!code-csharp [ThemeService Implementation](https://github.com/unoplatform/uno.extensions/blob/51c9c1ef14f686363f946588733faecc5a1863ff/src/Uno.Extensions.Core.UI/Toolkit/ThemeService.cs)]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if we can add such label into code-csharp, as the docfx docs are introducing it always with empty brackets after the lang id...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants