fix: close #1367
This commit is contained in:
1 parent
e932327ade
commit
4564e7efbf
2 files changed
+23
-4
No files matched your search
@@ -66,7 +66,7 @@
|
|||||||
<hc:SimplePanel Background="#FFE8E03F"/>
|
<hc:SimplePanel Background="#FFE8E03F"/>
|
||||||
</hc:TabItem>
|
</hc:TabItem>
|
||||||
</hc:TabControl>
|
</hc:TabControl>
|
||||||
<hc:TabControl Grid.Row="2" IsAnimationEnabled="True" Margin="0,32,0,0" ShowCloseButton="True" IsDraggable="True" ItemsSource="{Binding DataList}" MaxWidth="800" Height="300">
|
<hc:TabControl Grid.Row="2" IsAnimationEnabled="True" Margin="0,32,0,0" ShowCloseButton="True" IsDraggable="True" ItemsSource="{Binding DataList}" MaxWidth="800" Height="300" OverflowMenuDisplayMemberPath="Header">
|
||||||
<TabControl.ItemTemplate>
|
<TabControl.ItemTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding Header}"/>
|
<TextBlock Text="{Binding Header}"/>
|
||||||
|
|||||||
@@ -219,6 +219,15 @@ public class TabControl : System.Windows.Controls.TabControl
|
|||||||
set => SetValue(ShowScrollButtonProperty, ValueBoxes.BooleanBox(value));
|
set => SetValue(ShowScrollButtonProperty, ValueBoxes.BooleanBox(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static readonly DependencyProperty OverflowMenuDisplayMemberPathProperty = DependencyProperty.Register(
|
||||||
|
nameof(OverflowMenuDisplayMemberPath), typeof(string), typeof(TabControl), new PropertyMetadata(default(string)));
|
||||||
|
|
||||||
|
public string OverflowMenuDisplayMemberPath
|
||||||
|
{
|
||||||
|
get => (string) GetValue(OverflowMenuDisplayMemberPathProperty);
|
||||||
|
set => SetValue(OverflowMenuDisplayMemberPathProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 可见的标签数量
|
/// 可见的标签数量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -346,10 +355,20 @@ public class TabControl : System.Windows.Controls.TabControl
|
|||||||
|
|
||||||
if (item.DataContext is not null)
|
if (item.DataContext is not null)
|
||||||
{
|
{
|
||||||
menuItem.SetBinding(HeaderedItemsControl.HeaderProperty, new Binding(DisplayMemberPath)
|
if (ItemTemplate is null)
|
||||||
{
|
{
|
||||||
Source = item.DataContext
|
menuItem.SetBinding(HeaderedItemsControl.HeaderProperty, new Binding(DisplayMemberPath)
|
||||||
});
|
{
|
||||||
|
Source = item.DataContext
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
menuItem.SetBinding(HeaderedItemsControl.HeaderProperty, new Binding(OverflowMenuDisplayMemberPath)
|
||||||
|
{
|
||||||
|
Source = item.DataContext
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user