2
後不綁定不再工作,我有以下文本框在那裏工作得很好的結合,直到我添加的樣式:應用樣式
<TextBox Text="{Binding SelectedGroupPolicyTermSummary.ImportantInfo, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
HorizontalAlignment="Stretch" AcceptsReturn="True"
IsReadOnly="{Binding IsEditable, Converter={StaticResource InvertedBoolConverter}}"
Foreground="Red" TextWrapping="Wrap">
<TextBox.Style>
<Style TargetType="{x:Type TextBox}">
<Style.Triggers>
<Trigger Property="TextBox.IsReadOnly" Value="True">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}">
<TextBox Text="{TemplateBinding Text}"
VerticalAlignment="Bottom"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
Style="{DynamicResource SelectableTextStyle}"
TextWrapping="{TemplateBinding TextWrapping}"
Foreground="{TemplateBinding Foreground}"
Width="{TemplateBinding Width}"/>
</ControlTemplate>
</Setter.Value>
</Setter>
<Setter Property="Width" Value="Auto"/>
</Trigger>
<Trigger Property="TextBox.IsReadOnly" Value="False">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type TextBox}" >
<TextBox Text="{TemplateBinding Text}"
VerticalAlignment="Bottom"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
Style="{DynamicResource TextBoxStyle}"
TextWrapping="{TemplateBinding TextWrapping}"
Foreground="{TemplateBinding Foreground}"
Width="{TemplateBinding Width}"
AcceptsReturn="{TemplateBinding AcceptsReturn}">
</TextBox>
</ControlTemplate>
</Setter.Value>
</Setter>
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
我應用該樣式的文本框中填入後,但任何更改都不會發回到代碼。任何想法爲什麼?
非常感謝你,這解決了問題:) – soaloa