C# 样式导入XAML组件
我有一个XAML文件,为stackpanel定义了资源。我想做的是在不影响此视图中其他TextBlox的情况下设置TextBox的样式 我的主要观点C# 样式导入XAML组件,c#,.net,wpf,xaml,C#,.net,Wpf,Xaml,我有一个XAML文件,为stackpanel定义了资源。我想做的是在不影响此视图中其他TextBlox的情况下设置TextBox的样式 我的主要观点 <UserControl x:Class="Comsol.STEA.ProjectViewModule.View.ResourceProfileView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://sche
<UserControl x:Class="Comsol.STEA.ProjectViewModule.View.ResourceProfileView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Resources="clr-namespace:Comsol.STEA.Core.Resources;assembly=Core"
xmlns:Converters1="clr-namespace:Comsol.STEA.Core.Utilities.Converters;assembly=Core"
xmlns:Commands="clr-namespace:Comsol.STEA.ProjectViewModule.Commands"
xmlns:ResourceProfileViews="clr-namespace:Comsol.STEA.ProjectViewModule.View.ResourceProfileViews"
xmlns:Behaviors="clr-namespace:WpfLib.Behaviors;assembly=WpfLib"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Resources/Resources.xaml" />
</ResourceDictionary.MergedDictionaries>
<Converters1:BoolToCollapsedVisibilityConverter x:Key="btcvc"/>
</ResourceDictionary>
</UserControl.Resources>
<StackPanel Background="{DynamicResource SteaBackgroundBrush}"
FocusManager.FocusedElement="{Binding ElementName=NameBox}">
<StackPanel.Resources>
<Style TargetType="{x:Type TextBox}">
<Setter Property="Width" Value="360"/>
<Setter Property="MinLines" Value="3"/>
</Style>
</StackPanel.Resources>
<GroupBox Header="{x:Static Resources:Strings.ProfileSettings}">
<StackPanel>
<AdornerDecorator Visibility="{Binding Path=AnyAvailableCategories, Converter={StaticResource btcvc}}">
<StackPanel>
<ResourceProfileViews:DescriptionView/>
</StackPanel>
</AdornerDecorator>
</StackPanel>
</GroupBox>
</StackPanel>
</UserControl>
描述视图
<StackPanel Orientation="Horizontal">
<Label Content="{x:Static Resources:Strings.Description}"/>
<TextBox Text="{Binding Path=Description, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"/>
</StackPanel>