AvaloniaUI / Avalonia.Controls.TreeDataGrid

A combined TreeView/DataGrid for Avalonia.
MIT License
233 stars 48 forks source link

TreeDataGrid and VerticalScrollBarVisibility & VerticalScrollBarVisibility don't work #264

Open KentSwan opened 4 months ago

KentSwan commented 4 months ago

TreeDataGrid rejects the VerticalScrollBarVisibility and HorizontalScrollBarVisibility properties which relate to setting up its internal scrollbars. Am I missing something here? Per my previous post, all of this is being tested at the most recent implementation Version levels.

        <TreeDataGrid   Name="countries"
                        Source="{Binding Source}"
                        Height="Auto"
                        Width="Auto"
                        VerticalScrollBarVisibility="Auto"
                        HorizontalScrollBarVisibility="Auto"
                        AutoDragDropRows="True">

What I'm trying to test here is what code I have to add so that the TreeDataGrid scroll viewport will move to ensure that a selected item comes into view if not already visible in the scroll viewport. A not-in-view condition occurs when a key up/down page up/down, home, or end selects an out-of-viewport item. It can also happen when a search or insertion selection in a key column causes TreeDataGrid to select an item outside of the current scroll viewport.

KentSwan commented 4 months ago

Some more info. In the design viewer, the TreeDataGrid shows the treedatagrid's vertical scroll bars in the viewable collapsed state and allows mouse thumb scrolling but when I run the app in debug mode in VS2022 the scrollbars are not present. I'm running everything at the current version levels including the TreeDataGrid package from Nuget which is after the latest theme changes to bases styled controls on a generic base theme.

KentSwan commented 4 months ago

More information. In VS2022 the scrollbars show up and work in the axaml designer window of the individual views but when those views are installed in a TabControl's TabItem content in MainWindow, the views scroll bars don't show up.

The control axaml setup in the MainWindow view is as follows.


    <StackPanel>
        <Border BorderBrush="Black"
                BorderThickness="1"
                Background="AliceBlue">
            <TextBlock Text="{Binding Greeting}"
                       FontWeight="Bold"
                       HorizontalAlignment="Center"/>
        </Border>

        <TabControl>
            <TabItem Header="Countries">
                <v:CountriesPageView/>
            </TabItem>
            <TabItem Header="Files">
                <v:FilesPageView/>
            </TabItem>
            <TabItem Header="DragDrop">
                <v:DragDropPageView/>
            </TabItem>
            <TabItem Header="Wikipedia">
                <v:WikipediaPageView/>
            </TabItem>
        </TabControl>

    </StackPanel>
KentSwan commented 4 months ago

Well, I think I found the interference problem. In the current Avalonia UI, the scroll bars of a TreeDataGrid control will be suppressed if the control is a control inside of a stack panel, apparently at any nested level. NFC as how or why that occurs or if it's an inherent UI design constraint related to Stack Panels. (NFC is short for No F***ing Clue) For this reason, I'm switching my demo over to using a Dock on the main window with a top dock to handle the header and the tabbed views below that.