How can I use an ElementName binding within a ControlTemplate?

前端 未结 1 1753
说谎
说谎 2021-02-19 18:39

I have multiple TextBlocks which reference different elements in my application. My code works fine when used directly in the page. However, I want to create a ControlTemplate

1条回答
  •  生来不讨喜
    2021-02-19 19:23

    This seems like a funny way to template something, but it can be done, you just have to get a bit fancy with your bindings.

    The below will work, but I still dont think this is a good way to template a control

    Bind the TextBlock Tag to the actual Element, then in the ControlTemplate bind Tag to Tag and use the values from there as Tag is the Element, you can use any element from it.

    
        
            
        
    
    
        
        
        
        
        
        
    
    

    0 讨论(0)
提交回复
热议问题