dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
21.96k stars 1.7k forks source link

Add common desktop controls (TabControl, TreeView, GridSplitter) #14341

Open mgoertz-msft opened 1 year ago

mgoertz-msft commented 1 year ago

Description

Most desktop and larger form factor mobile apps need common controls, such as TabControl, TreeView, and GridSplitter. We should consider adding those to the SDK itself.

Public API Changes

<TabControl>
    <TabItem Text="Tab1" />
    <TabItem Text="Tab2" />
</TabControl>
<TreeView>
    <TreeViewItem Text="Root">
        <TreeViewItem Text="Child" />
    </TreeViewItem>
</TreeView>
<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="5" />
        <ColumnDefinition Width="*" />
    </Grid.ColumnDefinitions>
    <Label Text="Left" />
    <GridSplitter Grid.Column="1" Width="5" />
    <Label Text="Right" />
</Grid>

Intended Use-Case

<TabControl>
    <TabItem Text="Tab1" />
    <TabItem Text="Tab2" />
</TabControl>
<TreeView>
    <TreeViewItem Text="Root">
        <TreeViewItem Text="Child" />
    </TreeViewItem>
</TreeView>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="5" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <TextBlock FontSize="55" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap">Left side</TextBlock>
        <GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" />
        <TextBlock Grid.Column="2" FontSize="55" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap">Right side</TextBlock>
    </Grid>
BretJohnson commented 1 year ago

+1 These were the 3 missing controls our fairly simple desktop app, for app building, needed.

NonameMissingNo commented 1 year ago

I might be ignorant, but what's the difference between the proposed TabControl, and a TabbedPage? The third one is not a bad thing, but it also takes 10 minutes to implement one, just a view, that is 5 width and perhaps colored.

ghost commented 1 year ago

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

mouralabank commented 1 year ago

Any updates on this issue?

mouralabank commented 1 year ago

I really need a grid splitter, any workaround?

BretJohnson commented 1 year ago

@mouralabank - Here's an old implementation for Xamarin.Forms that could work, being ported over https://github.com/andreinitescu/GridSplitterApp

daltzctr commented 1 year ago

It looks like WinUI3 Community Toolkit has a Grid Splitter control, is it possible/plausible to wrap it with a handler?

daltzctr commented 1 year ago

The answer is no. This is because MAUI does not use a WinUI3 Grid for their PlatformView for the MAUI shared grid control. We'd need to either fix this (a maintainer said this wasn't going to happen in another issue) or create an entirely desktop specific grid control (which I also doubt will happen in this or the Community Toolkit repository).

Because of these two factors, I doubt this issue will get any traction in any recent timeline (next 2 years).

lfmouradasilva commented 1 year ago

Any updates on this issue?

Florian-Voss commented 11 months ago

The third one is not a bad thing, but it also takes 10 minutes to implement one, just a view, that is 5 width and perhaps colored.

A GridSplitter is not only a line of 5px for visual seperation. It also provides Drag & Drop functionality to resize columns and rows of a Grid. Thats actually the more important thing, to allow the user to resize.

t3377806 commented 1 week ago

I wanted to switch the project to MAUI two years ago, but without these features, it was really difficult to get started with desktop applications.

Still waiting...