如何在wpf中更改listview中文本框的背景颜色

时间:2015-03-05 05:57:21

标签: wpf xaml textbox

我有两个带有文本框的列表视图。如果加载后文本框值不同,我想更改文本框的背景颜色。怎么做?

示例XAML是

<ListView Name="lstBase">
  <ListView.View>
    <DataTemplate>
      <TextBox Name="txtBase" Text="{Binding BaseText}" Width="160" BorderThickness="0.5" BorderBrush="Black"/>
    </DataTemplate>
  </ListView.View>
</ListView>
<ListView Name="lstTarget">
  <ListView.View>
    <DataTemplate>
      <TextBox Name="txtTarget" Text="{Binding TargetText}" Width="160" BorderThickness="0.5" BorderBrush="Black"/>
    </DataTemplate>
  </ListView.View>
</ListView>

1 个答案:

答案 0 :(得分:0)

        <ListView>
            <TextBox Background="black" Height="20" Width="90"/>
        </ListView>