是否有可能設置的SolidColorBrush的厚度方向性能。我問的原因是,我有一個的IValueConverter綁定到文本框邊框BorderBrush屬性和我動態設置文本框的顏色,的SolidColorBrush厚度財產
<Window x:Class="MyWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" Width="600" Height="570">
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type TextBlock}" x:Key="Style1">
<Setter Property="BorderBrush" Value="DarkGrey" />
<Setter Property="BorderThickness" Value="1" />
</Style>
<Style TargetType="{x:Type TextBlock}" x:Key="Style2">
<Setter Property="BorderBrush" Value="Red" />
<Setter Property="BorderThickness" Value="2" />
</Style>
</ResourceDictionary>
你能告訴我怎麼用IValueConverter做這件事嗎? – developer 2010-03-25 15:04:48
請參閱如何訪問樣式... – TabbyCool 2010-03-25 16:53:38
我想我的貼轉換器的代碼編輯答案。你可以編輯它,並告訴我如何使用樣式添加邊框的厚度和顏色。我是wpf的新手,所以如果你可以請求幫助。 – developer 2010-03-25 17:17:48