-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #520 from Amrykid/metro-tabitem-patch2
[RFC] Metro TabItem/TabControl Patch #2
- Loading branch information
Showing
9 changed files
with
273 additions
and
68 deletions.
There are no files selected for viewing
27 changes: 2 additions & 25 deletions
27
MahApps.Metro/Controls/MetroAnimatedSingleRowTabControl.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,15 @@ | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Input; | ||
|
||
namespace MahApps.Metro.Controls | ||
{ | ||
public class MetroAnimatedSingleRowTabControl : TabControl | ||
public class MetroAnimatedSingleRowTabControl : BaseMetroTabControl | ||
{ | ||
public MetroAnimatedSingleRowTabControl() | ||
{ | ||
DefaultStyleKey = typeof(MetroAnimatedSingleRowTabControl); | ||
} | ||
|
||
public Thickness TabStripMargin | ||
{ | ||
get { return (Thickness)GetValue(TabStripMarginProperty); } | ||
set { SetValue(TabStripMarginProperty, value); } | ||
} | ||
|
||
// Using a DependencyProperty as the backing store for TabStripMargin. This enables animation, styling, binding, etc... | ||
public static readonly DependencyProperty TabStripMarginProperty = | ||
DependencyProperty.Register("TabStripMargin", typeof(Thickness), typeof(MetroAnimatedSingleRowTabControl), new PropertyMetadata(new Thickness(0))); | ||
|
||
protected override DependencyObject GetContainerForItemOverride() | ||
{ | ||
return new MetroTabItem() { OwningTabControl = this }; //Overrides the TabControl's default behavior and returns a MetroTabItem instead of a regular one. | ||
} | ||
|
||
public ICommand CloseTabCommand | ||
{ | ||
get { return (ICommand)GetValue(CloseTabCommandProperty); } | ||
set { SetValue(CloseTabCommandProperty, value); } | ||
} | ||
|
||
public static readonly DependencyProperty CloseTabCommandProperty = | ||
DependencyProperty.Register("CloseTabCommand", typeof(ICommand), typeof(MetroAnimatedSingleRowTabControl), new PropertyMetadata(new MahApps.Metro.Controls.MetroTabControl.DefaultCloseTabCommand())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,15 @@ | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Input; | ||
|
||
namespace MahApps.Metro.Controls | ||
{ | ||
public class MetroAnimatedTabControl : TabControl | ||
public class MetroAnimatedTabControl : BaseMetroTabControl | ||
{ | ||
public MetroAnimatedTabControl() | ||
{ | ||
DefaultStyleKey = typeof(MetroAnimatedTabControl); | ||
} | ||
|
||
public Thickness TabStripMargin | ||
{ | ||
get { return (Thickness)GetValue(TabStripMarginProperty); } | ||
set { SetValue(TabStripMarginProperty, value); } | ||
} | ||
|
||
// Using a DependencyProperty as the backing store for TabStripMargin. This enables animation, styling, binding, etc... | ||
public static readonly DependencyProperty TabStripMarginProperty = | ||
DependencyProperty.Register("TabStripMargin", typeof(Thickness), typeof(MetroAnimatedTabControl), new PropertyMetadata(new Thickness(0))); | ||
|
||
protected override DependencyObject GetContainerForItemOverride() | ||
{ | ||
return new MetroTabItem() { OwningTabControl = this }; //Overrides the TabControl's default behavior and returns a MetroTabItem instead of a regular one. | ||
} | ||
|
||
public ICommand CloseTabCommand | ||
{ | ||
get { return (ICommand)GetValue(CloseTabCommandProperty); } | ||
set { SetValue(CloseTabCommandProperty, value); } | ||
} | ||
|
||
public static readonly DependencyProperty CloseTabCommandProperty = | ||
DependencyProperty.Register("CloseTabCommand", typeof(ICommand), typeof(MetroAnimatedTabControl), new PropertyMetadata(new MahApps.Metro.Controls.MetroTabControl.DefaultCloseTabCommand())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.