HandyOrg / HandyOrg/HandyControl

[Feature request] Add "new tab" button to <hc:TabControl>

Open
#1,144 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

:factory: enhancement
Dominant language
C#
Stars
7.2k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

Is your feature request related to a problem? Please describe.
In our application we use the <hc:TabControl> control to let the user have different workspaces and perform different tasks in parallel like tabs in a web browser. We have a "+ New tab" button ("Nueva pestaña" in spanish) and when the user clicks the button a new tab is added to the ViewModel.

image

It would be nice to have a way to add an extra button in the tab strip like in Google Chrome, to let the user add a new tab.

This is our current setup (in case it matters)

<hc:TabControl 
    TabStripPlacement="Bottom"
    Grid.Column="1"
    TabIndex="-1"
    KeyboardNavigation.TabNavigation="None"
    x:Name="tabControl" 
    ShowCloseButton="True" 
    ShowOverflowButton="True"
    ShowScrollButton="True"
    IsDraggable="True" 
    IsScrollable="True"
    IsAnimationEnabled="True"
    IsTabFillEnabled="False"
    Validation.ErrorTemplate="{x:Null}"
    ItemsSource="{Binding Workspaces}"
    SelectedItem="{Binding SelectedWorkspace}">
    <hc:TabControl.ItemTemplate>
        <DataTemplate>
            <StackPanel Orientation="Horizontal" MaxWidth="200">
                <fa:IconBlock Icon="{Binding Page.Icon, FallbackValue=None}" FontSize="12" IconFont="Solid" Margin="0,0,8,0"/>
                <TextBlock Text="{Binding Page.Title}"/>
            </StackPanel>
        </DataTemplate>
    </hc:TabControl.ItemTemplate>
    <hc:TabControl.ContentTemplate>
        <DataTemplate>
            <ContentControl Content="{Binding Page}" Validation.ErrorTemplate="{x:Null}"/>
        </DataTemplate>
    </hc:TabControl.ContentTemplate>
</hc:TabControl>

Describe the solution you'd like
An easy solution would be to add a <hc:TabControl.ExtraToolsTemplate> that can be customized via xaml. In this way would add our custom button to the end of the TabControl, and user who don't want that functionality would be unafected.

Something like this:

<hc:TabControl  ItemsSource="{Binding Workspaces}" SelectedItem="{Binding SelectedWorkspace}">
    <hc:TabControl.ExtraToolsTemplate>
        <DataTemplate>
            <Button Width="32" Command="{Binding AddWorkspaceCommand}">
                <fa:IconBlock Icon="Plus"/>
            </Button>
        </Button >
    </hc:TabControl.ExtraToolsTemplate>
</hc:TabControl>

This way developers will be able to add extra tools like "Add Foo tab", "Sort tabs" or other domain specific tools in the same DataTemplate.

Describe alternatives you've considered
Currently I use a separate button at the top bar, but is not intuitive and unconventional.

Additional context
Add any other context or screenshots about the feature request here.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing hc:TabControl control and its XAML template or styling entry point. Review how optional control templates and tab-strip tools are exposed, then verify that an ExtraToolsTemplate can render custom commands such as a new-tab button while leaving controls without the template unaffected.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.