Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在选项卡控件对象中禁用选项卡换行_C#_Wpf_Tabcontrol_Word Wrap - Fatal编程技术网

C# 如何在选项卡控件对象中禁用选项卡换行

C# 如何在选项卡控件对象中禁用选项卡换行,c#,wpf,tabcontrol,word-wrap,C#,Wpf,Tabcontrol,Word Wrap,我正在WPF/C中设计一个GUI,并使用Tab控件对象。我的选项卡控件将包含许多选项卡,我想知道如何禁用对象的默认包装行为。基本上与问题相反。我该怎么做呢 谢谢。只需更改项目名称: 只需更改项目spanel: 这实际上不起作用。它会更改选项卡内容的面板,而不是选项卡标题。因此,我必须为此创建一个单独的样式,然后?@ericafterdark如果方便的话,那么您可以将所有与模板相关的XAML移到一个单独的ResourceDictionary文件或类似文件中。@HighCore该模板的哪些内容对于进

我正在WPF/C中设计一个GUI,并使用Tab控件对象。我的选项卡控件将包含许多选项卡,我想知道如何禁用对象的默认包装行为。基本上与问题相反。我该怎么做呢

谢谢。

只需更改项目名称:

只需更改项目spanel:


这实际上不起作用。它会更改选项卡内容的面板,而不是选项卡标题。因此,我必须为此创建一个单独的样式,然后?@ericafterdark如果方便的话,那么您可以将所有与模板相关的XAML移到一个单独的ResourceDictionary文件或类似文件中。@HighCore该模板的哪些内容对于进行此更改是绝对必要的?我希望代码尽可能的简约。@ERICATURDERK只支持StackPanel。这实际上不起作用。它会更改选项卡内容的面板,而不是选项卡标题。因此,我必须为此创建一个单独的样式,然后?@ericafterdark如果方便的话,那么您可以将所有与模板相关的XAML移到一个单独的ResourceDictionary文件或类似文件中。@HighCore该模板的哪些内容对于进行此更改是绝对必要的?我希望代码尽可能的简约,只有StackPanel。
<TabControl ....>
   <TabControl.ItemsPanel>
     <ItemsPanelTemplate>
        <StackPanel Orientation="Horizontal"/>
     </ItemsPanelTemplate>
   </TabControl.ItemsPanel>
  ....
</TabControl>
<TabControl>
        <TabControl.Template>
            <ControlTemplate TargetType="{x:Type TabControl}">
                <Grid ClipToBounds="true" SnapsToDevicePixels="true" KeyboardNavigation.TabNavigation="Local">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition x:Name="ColumnDefinition0"/>
                        <ColumnDefinition x:Name="ColumnDefinition1" Width="0"/>
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition x:Name="RowDefinition0" Height="Auto"/>
                        <RowDefinition x:Name="RowDefinition1" Height="*"/>
                    </Grid.RowDefinitions>
                    <StackPanel x:Name="HeaderPanel" Grid.Column="0" IsItemsHost="true" Margin="2,2,2,0" Grid.Row="0" KeyboardNavigation.TabIndex="1" Panel.ZIndex="1" Orientation="Horizontal"/>
                    <Border x:Name="ContentPanel" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Grid.Column="0" KeyboardNavigation.DirectionalNavigation="Contained" Grid.Row="1" KeyboardNavigation.TabIndex="2" KeyboardNavigation.TabNavigation="Local">
                        <ContentPresenter x:Name="PART_SelectedContentHost" ContentSource="SelectedContent" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Border>
                </Grid>
                <ControlTemplate.Triggers>
                    <Trigger Property="TabStripPlacement" Value="Bottom">
                        <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="1"/>
                        <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
                        <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                        <Setter Property="Height" TargetName="RowDefinition1" Value="Auto"/>
                        <Setter Property="Margin" TargetName="HeaderPanel" Value="2,0,2,2"/>
                    </Trigger>
                    <Trigger Property="TabStripPlacement" Value="Left">
                        <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0"/>
                        <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
                        <Setter Property="Grid.Column" TargetName="HeaderPanel" Value="0"/>
                        <Setter Property="Grid.Column" TargetName="ContentPanel" Value="1"/>
                        <Setter Property="Width" TargetName="ColumnDefinition0" Value="Auto"/>
                        <Setter Property="Width" TargetName="ColumnDefinition1" Value="*"/>
                        <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                        <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
                        <Setter Property="Margin" TargetName="HeaderPanel" Value="2,2,0,2"/>
                    </Trigger>
                    <Trigger Property="TabStripPlacement" Value="Right">
                        <Setter Property="Grid.Row" TargetName="HeaderPanel" Value="0"/>
                        <Setter Property="Grid.Row" TargetName="ContentPanel" Value="0"/>
                        <Setter Property="Grid.Column" TargetName="HeaderPanel" Value="1"/>
                        <Setter Property="Grid.Column" TargetName="ContentPanel" Value="0"/>
                        <Setter Property="Width" TargetName="ColumnDefinition0" Value="*"/>
                        <Setter Property="Width" TargetName="ColumnDefinition1" Value="Auto"/>
                        <Setter Property="Height" TargetName="RowDefinition0" Value="*"/>
                        <Setter Property="Height" TargetName="RowDefinition1" Value="0"/>
                        <Setter Property="Margin" TargetName="HeaderPanel" Value="0,2,2,2"/>
                    </Trigger>
                    <Trigger Property="IsEnabled" Value="false">
                        <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </TabControl.Template>

      ...            
    </TabControl>