2016-07-07 4 views
1

私のXAMLコードで助けが必要です。 私はこのコードを持っています。私は完全に動作する各TextBoxコントロール内の参照のスタイルを使用します。別のResourceDictionaryからWindows.Resourceでスタイルを適用するXAML

xmlns:estilos="clr-namespace:Application.UtilityApplicationLayer.Recursos;assembly=UtilityApplicationLayer" 

<TextBox x:Name="Name" Style="{estilos:ApplicationWindowsResource ResourceKey=WaterMarkTextBox}"/> 
<TextBox x:Name="Middle name" Style="{estilos:ApplicationWindowsResource ResourceKey=WaterMarkTextBox}"/> 
<TextBox x:Name="Last name" Style="{estilos:ApplicationWindowsResource ResourceKey=WaterMarkTextBox}"/> 
<TextBox x:Name="Age" Style="{estilos:ApplicationWindowsResource ResourceKey=WaterMarkTextBox}"/> 

これで、それぞれのスタイルを直接適用せずにTextBoxコントロールを作成したいと考えています。私はこれをしたが、それはうまくいかない。 提案があります。

xmlns:estilos="clr-namespace:Application.UtilityApplicationLayer.Recursos;assembly=UtilityApplicationLayer" 

<Window.Resources> 
<ResourceDictionary> 
<Style TargetType="TextBox"> 
<Setter Property="Style" Value="{estilos:PractalisVentanasRecursos ResourceKey=WaterMarkTextBox}"/> 
</Style> 
</ResourceDictionary> 
</Window.Resources> 

<TextBox x:Name="Name" /> 
<TextBox x:Name="Middle name"/> 
<TextBox x:Name="Last name" /> 
<TextBox x:Name="Age"/> 

ありがとうございます。

+0

あなたはestilos UtilityApplicationLayerに住んでいるResourcesDictionaryを持っていますか?私は完全なリソース辞書Xamlコードを意味しますか? –

答えて

1

てみ使用スタイルのようになります。

<Style TargetType="TextBox" BasedOn="{estilos:PractalisVentanasRecursos ResourceKey=WaterMarkTextBox}"/> 
+1

ありがとう、それはあなたの助けを働かせます。 – MagnunStalin

関連する問題