例如,我想要将数字2作为目标
这应该返回积极的迹象:
ID Status
123 2
432 2
531 2
123 2
Run Code Online (Sandbox Code Playgroud)
这应该返回负面指示:
ID Status
123 1
432 3
531 2
123 2
Run Code Online (Sandbox Code Playgroud)
这应该返回负面指示:
ID Status
123 1
432 1
531 1
123 1
Run Code Online (Sandbox Code Playgroud)
谢谢
为什么不工作?
XAML:
<Window x:Class="WpfApplication1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="218" Width="239">
<Grid>
<ListBox Margin="12" Name="listBox1">
<Style TargetType="{x:Type ListBoxItem}">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=Name}" Value="Gil">
<Setter Property="ListBoxItem.Background" Value="Red" />
</DataTrigger>
</Style.Triggers>
</Style>
</ListBox>
</Grid>
</Window>
Run Code Online (Sandbox Code Playgroud)
代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WpfApplication1
{
public class User
{
private string name;
private string role;
public User(string strName, string strRole)
{
Name = strName;
Role = strRole;
}
public string Name
{
get { return name; }
set { name = value; …Run Code Online (Sandbox Code Playgroud)