使用xaml(wpf)我试图摆脱下面"插图A"中显示的选项卡控件下的行,使其最终看起来像"插图B":
插图A.
http://www.arulerforwindows.com/images/peskylinea.png
图B
http://www.arulerforwindows.com/images/peskylineb.png
当我定义选项卡项但显示附加到选项卡控件时,该行显示,因此更改选项卡项或选项卡控件之一或两者上的BorderThickness似乎不会产生所需的结果.
我需要在透明背景上执行此操作,其中不能使用实心填充矩形来掩盖问题.
这是代码:
<!--Tab Control-->
<Style TargetType="{x:Type TabControl}">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TabControl}">
<Grid KeyboardNavigation.TabNavigation="Local">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TabPanel Name="HeaderPanel" Grid.Row="0" Panel.ZIndex="1" Margin="0,0,0,-1" IsItemsHost="True" KeyboardNavigation.TabIndex="1" Background="Transparent" />
<Border
Name="Border"
Grid.Row="1"
Background="{StaticResource WindowBackgroundBrush}"
BorderBrush="{StaticResource DefaultSystemBrush}"
BorderThickness="1,1,1,1"
Margin="0,0,0,0"
CornerRadius="4"
KeyboardNavigation.TabNavigation="Local"
KeyboardNavigation.DirectionalNavigation="Contained"
KeyboardNavigation.TabIndex="2" >
<ContentPresenter
Name="PART_SelectedContentHost"
Margin="4"
ContentSource="SelectedContent" />
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}" />
<Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DisabledBorderBrush}" /> …Run Code Online (Sandbox Code Playgroud) 标准的System.Windows.Forms.TabControl组件在其包含的TabPages周围绘制边框.如果将Dock设置为Fill,这些边框将运行到父控件的边缘,但它们仍然存在,占用屏幕空间.
在Visual Studio中,如果将两个窗口停靠在同一位置,则会在底部获得一组类似TabControl的选项卡,但两侧没有边框.
是否有可能让TabControl以这种方式显示其TabPages,两侧没有浪费的屏幕空间?如果可能的话,我想避免使用自己绘制控件的解决方案.
我正在使用VB.NET
我需要在2个不同的选项卡上显示相同的控件(ListBox).
是否必须创建2个不同的ListBox实例?
是否有一种简单的方法为Visual Studio 2010中的选项卡控件中的选项卡设置键盘快捷键?我可以设置一些属性吗?
我在网上看了,但我看到的所有文章都很混乱.
如何在Windows窗体应用程序中添加+按钮TabControl.这是WPF的答案.但我想在WinForms应用程序中使用它?
如何使WinForms TabPage标题宽度适合它的标题?这是问题所在.

如何在TabControl中复制"tabPage"?
我试过这个:
//My TabControl: tc
//My Tab ID: 0
TabPage newPage = new TabPage();
foreach (Control control in tc.TabPages[0].Controls)
{
newPage.Controls.Add(control);
}
tc.TabPages.Add(newPage);
Run Code Online (Sandbox Code Playgroud)
但是不起作用..
提前致谢.
这些是我的类:
class mainViewModel
{
public List<Foo> F { get; set; }
public mainViewModel()
{
F=new List<Foo>()
{
new Foo(new Animal(){Name = "Cat"}),
new Foo(new Animal(){Name = "Dog"}),
new Foo(new Animal(){Name = "Camel"})
};
}
}
public class Foo
{
public Animal Animal { get; set; }
public Foo(Animal animal)
{
Animal = animal;
}
}
public class Animal
{
public string Name { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
这是我的MainWindow Xaml代码:
<TabControl ItemsSource="{Binding Path=F}">
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Animal.Name}"/>
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate> …Run Code Online (Sandbox Code Playgroud) 我正在使用For Each循环:
For Each tab As TabPage in TabControl1.TabPages
Run Code Online (Sandbox Code Playgroud)
我无法检索选项卡的索引.有没有办法做到这一点?我试图查看索引是低于还是高于当前指数.
我正在使用MahApps TabControl,我有几个TabItems:
<TabControl Name="tabControl" FontSize="12">
<TabItem Header="Statistics" />
</TabControl>
Run Code Online (Sandbox Code Playgroud)
我试图改变font的大小TabControl,并TabItems以调整我的头,但似乎这不是什么变化.