How to get DataTemplate.DataTrigger to check for greater than or less than?

前端 未结 4 1150
忘掉有多难
忘掉有多难 2020-12-01 15:38

The following DataTemplate.DataTrigger makes the age display red if it is equal to 30.

How do I make the age display red if it is

4条回答
  •  时光取名叫无心
    2020-12-01 16:21

    If possible, you could add a property to your model, that's the easiest way. Eg.

    public int AgeBoundry
    {
        get
        {
            if (Age < 30)
                return 0;
            else if (Age == 30)
                return 1;
            else
                return 2;
        }
    }
    

    then you can check on the value of the integer.

    
        
            0
             
        
        
            1
             
        
        
            2
             
        
    
    

提交回复
热议问题