首页 > 解决方案 > Gtk# 应用程序未正确呈现 TreeView

问题描述

我正在尝试使用 gtk# 在 mac 上开发 gtk 应用程序。我像在教程中一样创建了一个树视图,但是箭头没有正确渲染,如下所示,没有箭头。我可以单击打开和关闭,但实际的箭头不起作用。

图片

我复制粘贴了教程中的代码,它做了同样的事情,但这是我的代码在任何地方。我也验证了 view.ShowExpanders 设置为 true

        Application.Init();

        Window window = new Window("Editor Window");

        window.SetPosition(WindowPosition.Center);
        window.HeightRequest = 800;
        window.WidthRequest = 1200;

        TreeView view = new TreeView();

        view.WidthRequest = 500;

        TreeViewColumn column = new TreeViewColumn();
        column.Title = "Heirarchy";

        CellRendererText cell = new CellRendererText();

        column.PackStart(cell, true);

        view.AppendColumn(column);

        column.AddAttribute(cell, "text", 0);

        TreeStore store = new TreeStore(typeof(string));

        TreeIter i = store.AppendValues("Project");
        i = store.AppendValues(i,"Room1");
        i = store.AppendValues(i, "Item");
        store.AppendValues(i, "Attribute");
        store.AppendValues(i, "Attribute");
        store.AppendValues(i, "Attribute");


        view.ShowExpanders = true;

        view.Model = store;
        view.ShowExpanders = true;

        window.Add(view);

        window.DeleteEvent += ExitWindow;

        window.ShowAll();

        Application.Run();

是否有某种图像资产在我的计算机上不存在?我将如何在mac上安装它?感谢您提供任何帮助。

标签: c#macosgtkgtk#

解决方案


正如评论所建议的那样,使用brew install adwaita-icon-theme解决了问题


推荐阅读