Uno平台是否支持TreeView



我有一个WinUI3应用程序在Uno平台上运行,我正在尝试实现TreeView。我试过几个我在网上找到的例子,但没有一个效果很好。唯一编译过的是来自unoplatform github的:https://github.com/unoplatform/uno/blob/master/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/TreeView/TreeViewBasics.xaml

在这里我们可以看到xaml和cs代码:

XAML:

<Page
x:Class="UITests.Microsoft_UI_Xaml_Controls.TreeView.TreeViewBasics"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:UITests.Microsoft_UI_Xaml_Controls.TreeView"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:muxc="using:Microsoft.UI.Xaml.Controls"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
mc:Ignorable="d">
<Grid>
<muxc:TreeView>
<muxc:TreeView.RootNodes>
<muxc:TreeViewNode x:Name="RootNode" Content="Flavors" IsExpanded="True">
<muxc:TreeViewNode.Children>
<muxc:TreeViewNode Content="Vanilla" />
<muxc:TreeViewNode Content="Strawberry" />
<muxc:TreeViewNode Content="Chocolate">
<muxc:TreeViewNode.Children>
<muxc:TreeViewNode Content="Dark" />
<muxc:TreeViewNode Content="White" />
</muxc:TreeViewNode.Children>
</muxc:TreeViewNode>
<muxc:TreeViewNode Content="Caramel" />
</muxc:TreeViewNode.Children>
</muxc:TreeViewNode>
</muxc:TreeView.RootNodes>
</muxc:TreeView>
</Grid>
</Page>

cs:

using Uno.UI.Samples.Controls;
using Windows.UI.Xaml.Controls;
namespace UITests.Microsoft_UI_Xaml_Controls.TreeView
{
[Sample("TreeView")]
public sealed partial class TreeViewBasics : Page
{
public TreeViewBasics()
{
this.InitializeComponent();         
}
}
}

所以,我真的很想知道是否有人能够正确使用这些代码,以及它是否正常工作。当我运行它时,它什么也没出现。

我还观察到,他们在这里使用Uno.UI.Samples.Controls,我担心这可能是我问题的根源,但我不能使用它,因为我实际上使用了Uno.WinUI,如果我同时使用了两个金块包和抱怨它。

如果有人能回答我的一些疑虑,我会非常高兴。

谢谢。

TreeView显示在Uno平台游乐场上:https://playground.platform.uno/#treeview

然而,本文档指出了几个未实现的功能:https://platform.uno/docs/articles/implemented/windows-ui-xaml-controls-treeview.html

如果你遇到困难,也许可以联系Uno平台的支持。

最新更新