我正在尝试将垂直滚动条应用于Dragablz TabControl。最小示例:
MainWindow.cs
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
TabablzControl tb = new TabablzControl();
TabItem tabItem;
for (int i = 0; i < 15; i++)
{
tabItem = new TabItem
{
Header = $"Tab_{i}"
};
tb.Items.Add(tabItem);
}
tb.TabStripPlacement = Dock.Left;
MystackPanel.Children.Add(tb);
}
}
MainWindow.xaml :
<Window x:Class="WpfApp3.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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:local="clr-namespace:WpfApp3"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<ScrollViewer>
<StackPanel x:Name="MystackPanel">
</StackPanel>
</ScrollViewer>
</Window>
当前,垂直滚动条仅在将包含TabablzControl的堆栈面板用scrollviewer包装时出现。但是,仍然无法在选项卡中滚动。 我也尝试使用此解决方案https://stackoverflow.com/a/36919193/9200834来构建自定义控件模板。之所以失败,是因为该Dragablz样式不适用于TabItem对象。
有人知道如何在Dragablz标签上放置垂直滚动条吗?