本文介绍了在dragablz:TabablzControl wpf mvvm的所有其他选项卡中显示的另一个选项卡中的文本框长度与虚线相似的虚线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将 dragablz:TabablzControl 用于材料设计.第一个选项卡我添加了文本框.但所有其他选项卡上都出现了与文本框相似长度的虚线.如何删除此虚线.如果我使用普通的制表符控件,则不存在虚线.当我使用 dragablz:TabablzControl

I am using dragablz:TabablzControl with material design.first tab I have added text box. but all other tabs a dotted line of the similar length of text box is present. How can I remove this dotted line.If i use normal tab control no dotted line is present. dotted line is present when I am using dragablz:TabablzControl

请查看代码

MainWindow.xaml

<Window x:Class="WPFTabMenu.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:local="clr-namespace:WPFTabMenu"
        mc:Ignorable="d"
        xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz"
        xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
        Title="CoreProgramm WPF TabMenu"  Height="400" Width="880" ResizeMode="NoResize" 
        WindowStartupLocation="CenterScreen" WindowStyle="SingleBorderWindow" >
    <Grid >
        <Grid  >
            <dragablz:TabablzControl SelectedIndex="0"
                                      FixedHeaderCount="4" >
                <TabItem >
                    <TabItem.Header>
                        <materialDesign:PackIcon Kind="Home" Foreground="{DynamicResource PrimaryHueLightBrush}" />
                    </TabItem.Header>

                    <Grid  >
                        <Grid.ColumnDefinitions >
                            <ColumnDefinition Width="auto" />
                            <ColumnDefinition Width="1*" />
                            <ColumnDefinition Width="1*" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="100" />
                            <RowDefinition Height="100" />
                            <RowDefinition Height="1*" />
                        </Grid.RowDefinitions>
                        <TextBox Name="TextBoxName" Width="200"
                                Text="Name"></TextBox>
                  
                    </Grid>
                </TabItem>

                <TabItem Header="Customer details" Cursor="Hand" >
     
                </TabItem>
                <TabItem Header="Admin details" >
             
                </TabItem>
                <TabItem Header="Supplier details" >
                 

                </TabItem>

            </dragablz:TabablzControl>
        </Grid>
    </Grid>
</Window>

App.xaml

  <Application x:Class="BIExtractionUtilityTool.App"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:local="clr-namespace:BIExtractionUtilityTool"
                  xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz"
                 
       
 xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
                 StartupUri="Views/MainWindow.xaml">
        <Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                     <!--primary color--> 
                    <ResourceDictionary>
                         <!--include your primary palette--> 
                        <ResourceDictionary.MergedDictionaries>
                            <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/MaterialDesignColor.Blue.xaml" />
                        </ResourceDictionary.MergedDictionaries>
                        
                                <!--include three hues from the primary palette (and the associated forecolours).
                                Do not rename, keep in sequence; light to dark.-->
                            
                        <SolidColorBrush x:Key="PrimaryHueLightBrush" Color="{StaticResource Primary100}"/>
                        <SolidColorBrush x:Key="PrimaryHueLightForegroundBrush" Color="{StaticResource Primary100Foreground}"/>
                        <SolidColorBrush x:Key="PrimaryHueMidBrush" Color="{StaticResource Primary500}"/>
                        <SolidColorBrush x:Key="PrimaryHueMidForegroundBrush" Color="{StaticResource Primary500Foreground}"/>
                        <SolidColorBrush x:Key="PrimaryHueDarkBrush" Color="{StaticResource Primary700}"/>
                        <SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush" Color="{StaticResource Primary700Foreground}"/>
                    </ResourceDictionary>
    
                     <!--secondary colour--> 
                    <ResourceDictionary>
                         <!--include your secondary pallette--> 
                        <ResourceDictionary.MergedDictionaries>
                            <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
                            <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
                            <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/MaterialDesignColor.Blue.xaml" />
                        </ResourceDictionary.MergedDictionaries>
    
                        
                         <!--include a single secondary accent color (and the associated forecolour)--> 
                        <SolidColorBrush x:Key="SecondaryAccentBrush" Color="{StaticResource Accent200}"/>
                        <SolidColorBrush x:Key="SecondaryAccentForegroundBrush" Color="{StaticResource Accent200Foreground}"/>
                    </ResourceDictionary>
    
                     <!--Include the Dragablz Material Design style--> 
                    <ResourceDictionary Source="pack://application:,,,/Dragablz;component/Themes/materialdesign.xaml"/>
                    <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
                </ResourceDictionary.MergedDictionaries>
    
                 <!--tell Dragablz tab control to use the Material Design theme--> 
                <Style TargetType="{x:Type dragablz:TabablzControl}" BasedOn="{StaticResource MaterialDesignTabablzControlStyle}" />
            </ResourceDictionary>
    
        </Application.Resources>
    </Application>

虚线

推荐答案

尝试将以下隐式 Style 添加到您的 App.xaml 或窗口中:

Try to add the following implicit Style to your App.xaml or window:

<Style TargetType="materialDesign:BottomDashedLineAdorner">
    <Setter Property="Visibility" Value="Collapsed" />
</Style>

这篇关于在dragablz:TabablzControl wpf mvvm的所有其他选项卡中显示的另一个选项卡中的文本框长度与虚线相似的虚线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 11:52