Silverlight: How to use a binding in setter for a style (or an equivalent work around)

前端 未结 4 898
臣服心动
臣服心动 2020-12-17 15:26

If the person who answered this question is right, you cannot put a binding as the value in a setter in a style in Silverlight. Which is a shame, because I have 4 textblocks

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-17 16:02

    In Silverlight: Well... yeah, you can't do a binding. Here I used a static resource, (which probably won't meet your needs). This is closest you are going to get without doing the bindings in code.

    
    
      
        0.5
        
      
      
        
        
        
        
      
    
    

    EDIT: Well, here it is in WPF anyway...

    Here you go, in WPF:

    
      
        
      
      
        
        
        
        
      
    
    

    Of course you can get a lot more creative than this. Also, depending on how / when / where your styles are defined, it is sometimes easier just to do it in code.

提交回复
热议问题