如何解决ReactiveUI 使用后 TabControl 中的 WPF 额外文本
我的 TabControl 样式在我的项目中工作正常,但是在使用 ReactiveUI 后 ContentPresenter 中有文本。 当前样式的结构如下:
<Style targettype="{x:Type TabControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate targettype="{x:Type TabControl}">
<Grid>
<Border>
<ContentPresenter x:Name="PART_SelectedContentHost"/>
</Border>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
这是我的 Main.xml 代码:
<reactiveUi:ReactiveWindow x:TypeArguments="local:MainWindowviewmodel"
x:Class="Simlab.Drill.Console2D.Screens.MainWindowView"
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:Simlab.Drill.Console2D.Screens"
xmlns:reactiveUi="http://reactiveui.net"
mc:Ignorable="d"
ResizeMode="noresize"
d:DataContext="{d:DesignInstance local:MainWindowviewmodel}">
<Grid>
<Grid.RowDeFinitions>
<RowDeFinition Height="*" />
<RowDeFinition Height="Auto" />
</Grid.RowDeFinitions>
<reactiveUi:RoutedViewHost
Grid.Row="0"
x:Name="RoutedViewHost"
HorizontalContentAlignment="Stretch"
VerticalContentAlignment="Stretch" />
<TabControl Grid.Row="1" Margin="15" x:Name="Items" TabStripPlacement="Bottom">
</TabControl>
</Grid>
</reactiveUi:ReactiveWindow>
Tab1View.xaml 包含 TabItem 内容的标记:
<reactiveUi:ReactiveUserControl x:TypeArguments="local:Tab1viewmodel"
x:Class="Simlab.Drill.Console2D.Screens.MainTabs.Tab1View"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Simlab.Drill.Console2D.Screens.MainTabs"
xmlns:reactiveUi="http://reactiveui.net"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
<TextBlock Text="Tab 1" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</reactiveUi:ReactiveUserControl>
Here wrong text is framed by red
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。