irihitech / Ursa.Avalonia

Ursa is a UI library for building cross-platform UIs with Avalonia UI.
https://irihitech.github.io/Ursa.Avalonia/
MIT License
680 stars 65 forks source link

关于TreeComboBox的问题 #492

Open nblfeng opened 3 days ago

nblfeng commented 3 days ago

当Items使用如下的数据绑定时, 最后一个节点无法展开;

Items = new List<TreeComboBoxItemViewModel>( )
{
    new TreeComboBoxItemViewModel()
    {
        ItemName = "Item 2",
        Children = new List<TreeComboBoxItemViewModel>()
        {
            new TreeComboBoxItemViewModel { ItemName = "Item 2-2" },

        }
    },
    new TreeComboBoxItemViewModel()
    {
        ItemName = "Item 3",
    },
    new TreeComboBoxItemViewModel()
    {
        ItemName = "Item 4",
    },
    new TreeComboBoxItemViewModel()
    {
        ItemName = "Item 1",
        Children = new List<TreeComboBoxItemViewModel>()
        {
            new TreeComboBoxItemViewModel { ItemName = "Item 1-1" },
            new TreeComboBoxItemViewModel { ItemName = "Item 1-2" },
            new TreeComboBoxItemViewModel 
            { 
                ItemName = "Item 1-3",
                Children = new List<TreeComboBoxItemViewModel>()
                {
                    new TreeComboBoxItemViewModel { ItemName = "Item 1-3-1" }
                }
            },
        }
    },
};

image

rabbitism commented 3 days ago

默认开启虚拟化导致的,可以先使用正常的ItemsPanel

            <u:TreeComboBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel />
                </ItemsPanelTemplate>
            </u:TreeComboBox.ItemsPanel>