Giter Site home page Giter Site logo

wpfchrometabs-mvvm's People

Contributors

frankdekker avatar jizc avatar schreinerk avatar shreyasjejurkar avatar sskodje avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wpfchrometabs-mvvm's Issues

Working with many tabs!

I need some improvements for working with many tabs and have following ideas:

  1. Possibility to have different tab sizes: Auto Size for each tab, so that it has exactly that size the text needs.
  2. Tab rows: If tabs cannot be fully placed in a row the tabs should be distributed into several rows.
    What do you think about that?

Why it always crash in Windows XP SP3

i found if remove the code in "Generic.xaml" file it can run,

<Style TargetType="{x:Type local:ChromeTabControl}"> .... .... </Style>

but i can't remove it.Hope somebody help me,please~

How to place a "+โ€ as caption in the AddButton?

Is there any way to add text (caption) to the AddButton (Add tab button)?
I want to place a "+โ€ symbol on the AddButton. So that the user knows they can open a new tab by clicking on that button.
Thank you.

Grabbing a window throws exception when its the only tab

A first chance exception of type 'System.InvalidOperationException' occurred in PresentationFramework.dll
The program '[5796] Demo.vshost.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.

This exception is thrown when there are two tabs open and you drag the other one to new window and then close the remaining tab and drag the window back to the TabControl (to grab it as a tab again).

I want to add a function

I want to Add Command: CloseAllExcludingPinnedTabsCommand

if tabitem is pinned, execute CloseAllTabCommand ,don't close the pinned tabitems

Need support .NET Framework 4.5.1

I use the MVVM Light tool box create project (WPF451)
and download with NuGet
but click the top add button can't work .
.NET Framework 4.5.1 + MVVM Light 5.2.0

So i try to change demo code , .NET Framework 4 -> .NET Framework 4.5.1
MVVM Light 5.2.0
i got the same problem.

ArgumentOutOfRange exception in ChromeTabPanel.ProcessMouseMove(Point p)

Sometime a ArgumentOutOfRange exception in ChromeTabPanel.ProcessMouseMove(Point p) is thrown.
Problem is an access to a double array with an invalid index.
I suppose this could be the problem:
int localSlideIndex = this.slideIndex; if (margin.Left < this.slideIntervals[localSlideIndex - 1]) { SwapSlideInterval(localSlideIndex - 1); localSlideIndex -= 1; changed = 1; } else if (margin.Left > this.slideIntervals[localSlideIndex + 1]) { SwapSlideInterval(localSlideIndex + 1); localSlideIndex += 1; changed = -1; }
There is no check if localSlideIndex-1 is >= 0 and if it's < Count.
Please check all other source positions too.

Callstack:
image

Tabs still dragable

If you select a tab and in so doing the tabs move up or down so the mouse is not longer over said tab - then when you move the mouse back over the tab it still moves around until you press and release the mouse button.

Close tab with middle mouse button

Is it possible to close a tab by pressing the middle mouse button like in Chrome?

My application is not receiving the close command when I press the middle button.

ChromeTabs DLL is not Signed with a Strong Name Key

Hello,

I use ChromeTabs from NuGet in my application. Because my application is signed I get the error while ChromeTabs dll loading:

Could not load file or assembly 'ChromeTabs, Version=1.3.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)

Could you sign the assembly in NuGet package? Thank you.

Unable to change the size of the add tab button.

Currently it is possible to custom style the add tab button, but the size is hardcoded to new Size(20, 12). Line 111 in ChromeTabPanel.cs.

I added properties AddButtonWidth and AddButtonHeight to ChromeTabControl.cs, but my skills are kinda lacking to get this to work inside the ChromeTabPanel.cs.

You have some pointers how to update the _addButtonSize property inside ChromeTabPanel.cs when the width or height is set from xaml?

Sometimes an exception is thrown when clicking on a tab.

Sometime the chrome tab throws an out of bounds exception when clicking on a tab:
" at System.Windows.Controls.ItemCollection.GetItemAt(Int32 index)\r\n at ChromeTabs.ChromeTabControl.MoveTab(Int32 fromIndex, Int32 toIndex)\r\n at ChromeTabs.ChromeTabPanel.<>c__DisplayClass57_0.g__completed|0()\r\n at System.Windows.Media.Animation.Clock.FireEvent(EventPrivateKey key)\r\n at System.Windows.Media.Animation.Clock.RaiseAccumulatedEvents()\r\n at System.Windows.Media.Animation.TimeManager.RaiseEnqueuedEvents()\r\n at System.Windows.Media.Animation.TimeManager.Tick()\r\n at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)\r\n at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)\r\n at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)\r\n at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)"

I'm not sure but maybe it can be fixed by doing more checks in MoveTab.
Current code:
if (Items.Count == 0 || fromIndex == toIndex || fromIndex >= Items.Count)
{
return;
}
object fromTab = Items[fromIndex]; //fromIndex could be < 0
object toTab = Items[toIndex]; //toIndex could be < 0 and outside of array!

Better:
if (fromIndex == toIndex || fromIndex >= Items.Count || toIndex >= Items.Count || toIndex < 0 || fromIndex < 0)
{
return;
}

But I'm not sure if it fixes the bug. The question is why is a invalid index passed to the function and why is MoveTab called if I click on a tab page and release the mouse button. This should not trigger a MoveTab operation.

Window dragging, drags a new Tab after adding

If you have only one Tab, you can move the whole Window with that tab, but if you add a new Tab after the dragging, you drag that new Tab directly after adding. It's reproduceable in the Demo.

[Feature] Change TabControl to the latest Chrome design

Description

Change TabControl style to the latest Google Chrome design.

To Reproduce

N/a

Expected behavior

N/a

Additional context

I managed to recreate shape for the close button:

<Style TargetType="{x:Type Button}"
           x:Key="CloseButtonStyle">
        <Style.Resources>
            <sys:Double x:Key="CloseButtonWidth">7</sys:Double>
            <sys:Double x:Key="CloseCircleWidth">16</sys:Double>
            <sys:Double x:Key="CloseButtonOffset">4.5</sys:Double>
        </Style.Resources>
        <Setter Property="Height"
                Value="{StaticResource CloseCircleWidth}" />
        <Setter Property="Width"
                Value="{StaticResource CloseCircleWidth}" />
        <Setter Property="VerticalAlignment"
                Value="Center" />
        <Setter Property="HorizontalAlignment"
                Value="Center" />
        <Setter Property="Background"
                Value="Transparent" />
        <Setter Property="Foreground"
                Value="#45494C" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Canvas Background="Transparent"
                            x:Name="CloseButton"
                            Width="{StaticResource CloseCircleWidth}"
                            Height="{StaticResource CloseCircleWidth}">
                        <Ellipse Width="{StaticResource CloseCircleWidth}"
                                 Fill="{TemplateBinding Background}"
                                 Height="{StaticResource CloseCircleWidth}" />
                        <Canvas Canvas.Left="{StaticResource CloseButtonOffset}"
                                Canvas.Top="{StaticResource CloseButtonOffset}"
                                Background="Transparent"
                                Width="{StaticResource CloseButtonWidth}"
                                Height="{StaticResource CloseButtonWidth}">
                            <Line X1="0"
                                  Y1="0"
                                  X2="{StaticResource CloseButtonWidth}"
                                  Y2="{StaticResource CloseButtonWidth}"
                                  Stroke="{TemplateBinding Foreground}"
                                  StrokeThickness="1.5" />
                            <Line X1="0"
                                  Y1="{StaticResource CloseButtonWidth}"
                                  X2="{StaticResource CloseButtonWidth}"
                                  Y2="0"
                                  Stroke="{TemplateBinding Foreground}"
                                  StrokeThickness="1.5" />
                        </Canvas>
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver"
                     Value="True">
                <Setter Property="Background"
                        Value="#DCDCDD" />
            </Trigger>
        </Style.Triggers>
    </Style>

TabItem shape is calculated via TabShape class. It is hard to make any changes through code.
I think that it would be better if style is given via XAML (possibility to be styled via Blend in future).

Shape.Fill

This xaml command is not found on my system

Tab don't dispose when close

Hey you, i'm very interested your project, so i tried running your demo. Then i find out some problems. Tabs don't dispose when i close, so RAM increase.

Persisted VisualTree

I really like this TabControl, but is there a way to persist the VisualTree of the Tabs?
If i switch a Tab the VisualTree will be new generated and it loses all of its sorting settings.

The Problem is really good described here: http://www.codeproject.com/Articles/212233/Persist-the-Visual-Tree-when-switching-tabs-in-the
You can also take a look on Sascha Barbers Comment and his solution: http://www.codeproject.com/Articles/212233/Persist-the-Visual-Tree-when-switching-tabs-in-the?fid=1633690&df=10000&mpp=50&prof=False&sort=Position&view=Thread&spc=Relaxed&select=4702925#xx4702925xx

CloseTabCommand CanExecute

CloseTabCommand the canExecute is actually ignored. There is now way to prevent the user from closing the last tab using MVVM

Still alive?

Hi,

I just wanted to find out if this is still alive. I currently have a project (it's on github) that uses the default out of the box wpf tab control and it sucks.

I saw this project and felt that this would be the right fit.

Also will this work when i'm not using MVVM of any kinds?

Please let me know if you want the url to the project (it's not that big) and see if it can be an easy drop-in replacement.

Cheers

Exception inside of Tab shows Tabless Window

Hello,
first of all thank you for this Project. I was able to extend a program with tabs to support multiple views of data.
Anyway, sometimes inside the tabs, Exceptions are thrown which i can't seem to catch. The Program than starts up but doesn't show any tabs. I tried to catch them with AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledException);
but it seems only some are caught.
I built up the Program similar to your Demo and i would intentionally throw an Exception in your TabBase.cs Class to simulate errors (In a getter or setter or even in the constructor where I register commands). Then the Program gets caught up in a kind of empty Tabs state but it doesn't close or anything else where it passes by where I could log that error.
The only thing that comes to my mind is putting a tryCatch around every kind of critical function to log the error.
Do you have an Idea how to handle this properly?
Kind Regards

Buttons are disabled after closing Tab pressed

Inside a TabItem there is a button, originally enabled, and when pressed a message box is shown.
image

The ChromeTabControl is defined in my MainWindow and the Button is defined in UserControl1, which serves as the view of TabItem. Notice that the CloseCommand of ChromeTabControl left undefined on purpose.

<Window x:Class="playground.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:ct="clr-namespace:ChromeTabs;assembly=ChromeTabs"
        xmlns:local="clr-namespace:playground"
        mc:Ignorable="d"
        Title="MainWindow" Height="450" Width="800">
    <Window.Resources>
        <DataTemplate DataType="{x:Type local:CustomizedTabClass}">
            <local:UserControl1/>
        </DataTemplate>
    </Window.Resources>

    <DockPanel LastChildFill="True">
        <TextBlock DockPanel.Dock="Top" Text="fixed"/>
        <Grid DockPanel.Dock="Bottom" Margin="5">

            <ct:ChromeTabControl x:Name="MainTabControl"
                                ItemsSource="{Binding ItemCollection}"
                                SelectedItem="{Binding SelectedTab}"
                                TabPersistBehavior="All">

            </ct:ChromeTabControl>

        </Grid>
    </DockPanel>
</Window>

If I press "close" (as the black rectangle indicates), of course the tab will not be closed, but why is the button disabled?

image

Reordering tabs when a tab has been popped out throws exception

Great work on the previous issue, I got another problem with this. Hope you can help.

When the view of the tab is very "heavy", fast actions on popping out and reordering tabs throws this error from the MoveTab:

I couldn't reproduce it with your Demo app. I think it has to do with the fact that the tabs I am handling in my app are very heavy and maybe moving the tabs is too slow to react on the changes...?

internal void MoveTab(int fromIndex, int toIndex)
{
if (this.Items.Count == 0 || fromIndex == toIndex)
{
return;
}
object fromTab = this.Items[fromIndex];

System.ArgumentOutOfRangeException was unhandled by user code
HResult=-2146233086
Message=Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
Source=mscorlib
ParamName=index
StackTrace:
at System.Collections.ArrayList.get_Item(Int32 index)
at System.Windows.Data.ListCollectionView.InternalItemAt(Int32 index)
at ChromeTabs.ChromeTabControl.MoveTab(Int32 fromIndex, Int32 toIndex)
at ChromeTabs.ChromeTabPanel.<>c__DisplayClass8.b__5()
at ChromeTabs.ChromeTabPanel.<>c__DisplayClasse.b__d(Object o, EventArgs ea)
at System.Windows.Media.Animation.Clock.RaiseAccumulatedEvents()
at System.Windows.Media.Animation.TimeManager.RaiseEnqueuedEvents()
at System.Windows.Media.Animation.TimeManager.Tick()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
InnerException:

Preserve tab content when tearing tab to a new window

Hi. I've tab contents with a webview2. The url of the webview2 is bound to a viewmodel. Now when i tear out a tab only the viewmodel is passed along. If a new user control is initialized for that viewmodel, the browser will just create a new instance and load that url, losing the current navigation state. I've looked through the examples and source in depth, but I'm unable to find a solution.

My reasoning so far:

  • tearing away a tab should also pass the ChromeTabItem instance via TabDragEventArgs.
  • get the UIElement from the ChromeTabItem control.
  • transfer the UIElement to the new window.

As i'm quite stuck at the moment, any tips would be highly appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.