c# - Xamarin.Mac 中有任何类似的 "ListView"UI 控件吗?

标签 c# xamarin xamarin.ios mono xamarin.mac

我计划通过 Xamarin.Mac 基于 Aria2 JSON-RPC 和 C# GUI 为 macOS 设计一个多文件下载器应用程序(类似于 IDM 或传输)。但是 UI 设计有一个主要问题。我需要一个类似于 XAML 中的“ListView”的 UI 控件。

基本上它类似于 this topic 中的内容已讨论,即我需要在 Xamarin.Mac 中与下面的 XAML 代码等效的东西:

<ListView x:Name="DownloadItemList">
    <ListView.ItemTemplate>
        <DataTemplate>
            <StackPanel>
                <TextBlock Text="{Binding DownloadItemTitle}" 
                           Margin="20,0,20,8"
                           FontSize="24" 
                           FontStyle="Italic" 
                           FontWeight="SemiBold"
                           Foreground="DarkBlue" />
                <TextBlock Text="{Binding DownloadProgressInfo}" 
                           Margin="20,0,20,8"
                           FontSize="16"
                           Foreground="DarkGray" 
                           Opacity="0.8" />
            </StackPanel>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

如果可能的话,我还需要在 UI 代码中进行一些数据绑定(bind)。但到目前为止,我在 Xamarin.Mac 中找不到任何类似的东西。有没有这样的可能的解决方案?提前致谢!

最佳答案

您可以使用 NSTableView

静态内容: 您可以从 Storyboard设计单元格,如果需要,可以在运行时修改这些单元格的内容。

动态内容:您可以在设计时创建模板单元格(或以编程方式要求 id),为其提供标识符并在 tableviewd atasource 中多次使用该单元格.

关于c# - Xamarin.Mac 中有任何类似的 "ListView"UI 控件吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42823019/

相关文章:

c# - ListView - 在空数据源上显示 LayoutTemplate

xaml - 使用 Fontsize、FontAttributes 和 Horizo​​ntalOptions 时出现未处理的异常错误

c# - 错误 CS5001 : exe does not contain a static `Main' method suitable for an entry point

ios - Monotouch - iPhone静态加载Admob插页式广告

c# - 许多没有功能的派生类只能到 "know"它们的类型

c# - 在 C# 中使用 DataGridView 和 BindingList 时的线程安全建议

c# - 我如何确保 List<T>.Contains(T) 适用于我的自定义类?

visual-studio - 如何将 OSX Xamarin 项目迁移到 Windows 10 上的 Visual Studio?

c# - xamarin Studio for ios 在 Windows 上?

c# - 由于编码问题,在 iOS 上从 C# 调用 DLL 库时出现问题