Skip to content

added uno support #122

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

Merged
merged 3 commits into from
Mar 31, 2025
Merged

added uno support #122

merged 3 commits into from
Mar 31, 2025

Conversation

w-ahmad
Copy link
Owner

@w-ahmad w-ahmad commented Mar 27, 2025

Added Uno Platform Support

This PR adds Uno Platform support to WinUI.TableView, enabling compatibility with WebAssembly, macOS, and Linux.

Note:

  • Android and iOS support will be added in v1.4.
  • RowContext, CellContext, and Alternate Row Colors are currently not supported on Uno.

<Nullable>enable</Nullable>
<UseWinUI>true</UseWinUI>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DisableImplicitUnoPackages>true</DisableImplicitUnoPackages>

Choose a reason for hiding this comment

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

Would you recall why you needed to add this line?

Copy link
Owner Author

Choose a reason for hiding this comment

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

I added this to remove unwanted dependencies. my main concern was Uno.WinUI in case of net8.0-windows.
image

Choose a reason for hiding this comment

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

Got it! Most of those dependencies are dev-time only, they won't appear in your packages.

Comment on lines +4 to +8
net8.0-desktop;
net8.0;
net8.0-maccatalyst;
net8.0-windows10.0.26100;
net8.0-browserwasm;
Copy link

Choose a reason for hiding this comment

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

Noticed we aren't including android/ios tfms

It may work nicely on mobile as well under certain circumstances. Could be interesting to add them and see how it behaves in the sample app

Copy link
Owner Author

Choose a reason for hiding this comment

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

I did that intentionally cause TableView is not made for small screens. I tried it on android and that wasn't good. I'll try to make it available for small screens in 1.4 hopefully.

Comment on lines +19 to +23
<ItemGroup>
<PackageReference Include="CommunityToolkit.WinUI.Behaviors" Version="8.1.240916" />
<PackageReference Condition="'$(TargetFramework)' == 'net8.0-windows10.0.26100'" Include="Microsoft.WindowsAppSDK" Version="1.6.250108002" />
<PackageReference Condition="'$(TargetFramework)' != 'net8.0-windows10.0.26100'" Include="Uno.WinUI" Version="5.5.95" />
</ItemGroup>
Copy link

@kazo0 kazo0 Mar 29, 2025

Choose a reason for hiding this comment

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

This shouldn't™ be needed, I believe as long as we can remove the <DisableImplicitUnoPackages>true</DisableImplicitUnoPackages> from Jerome's comment

Copy link
Owner Author

Choose a reason for hiding this comment

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

correct!

@w-ahmad
Copy link
Owner Author

w-ahmad commented Mar 29, 2025

@jeromelaban @kazo0 can you guys help me to remove this build warning?
image

@kazo0
Copy link

kazo0 commented Mar 29, 2025

@jeromelaban @kazo0 can you guys help me to remove this build warning? image

Yes this issue is all too familiar. We have been discussing it recently. Uno currently does not support the ListViewItemPresenter. You can see that inside of Uno we instead use the ListViewItemExpanded style as the default style for ListViewItem: https://github.com/unoplatform/uno/blob/dc00d479789af7a35179fd1afc224b48272e077b/src/Uno.UI.FluentTheme.v2/Resources/Version2/PriorityDefault/ListViewItem_themeresources.xaml#L172-L174

We are currently investigating a way of implementing it in a "lightweight" type of way, without all the complexity that is needed for a true implementation. (Issue here: unoplatform/uno#19707)

This also explains the visual difference for things like the selection state on the TableView rows. You can see on Uno platforms it is missing the vertical blue rectangle to denote the selected row, as well as uses a different color for the selected background. (Screenshots taken from two separate apps, so don't worry about the content not being the same)

Windows (WinAppSDK):

Screenshot 2025-03-29 at 7 05 12 PM

Uno (net9.0-desktop on Windows)

image

I believe the best option for now would be to avoid using ListViewItemPresenter and have a custom ListViewItem Style that matches the visuals of the ListViewItemPresenter as much as possible

Let me know if you need any help with that. I will keep you posted on the status of the minimal ListViewItemPresenter implementation.

@w-ahmad
Copy link
Owner Author

w-ahmad commented Mar 30, 2025

I tested it on WASM, desktop, and WinUI, it works fine. The warning only appears with net8.0; all other frameworks build without this warning. Maybe I can leave it as it is for now and let it be tested by the community. If someone complains, then I'll think about it.

@w-ahmad w-ahmad marked this pull request as ready for review March 30, 2025 11:27
@w-ahmad w-ahmad merged commit f224f06 into main Mar 31, 2025
1 check passed
@w-ahmad w-ahmad deleted the uno-platform branch March 31, 2025 00:38
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