support for .NET framework 3.5
Still have bugs
This commit is contained in:
1 parent
5878039e21
commit
7d6b491f25
704 files changed
+48273
-33
No files matched your search
@@ -0,0 +1,30 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControl.Tools
|
||||
{
|
||||
public class TabItemCapsuleStyleSelector : StyleSelector
|
||||
{
|
||||
public override Style SelectStyle(object item, DependencyObject container)
|
||||
{
|
||||
if (item is TabItem tabItem && tabItem.Parent is TabControl tabControl)
|
||||
{
|
||||
var count = tabControl.Items.Count;
|
||||
if (count == 1)
|
||||
{
|
||||
return ResourceHelper.GetResource<Style>(ResourceToken.TabItemCapsuleSingle);
|
||||
}
|
||||
|
||||
var index = tabControl.Items.IndexOf(tabItem);
|
||||
return index == 0
|
||||
? ResourceHelper.GetResource<Style>(ResourceToken.TabItemCapsuleHorizontalFirst)
|
||||
: ResourceHelper.GetResource<Style>(index == count - 1
|
||||
? ResourceToken.TabItemCapsuleHorizontalLast
|
||||
: ResourceToken.TabItemCapsuleDefault);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user