WPF repeating elements

后端 未结 3 663
执念已碎
执念已碎 2021-02-09 21:56

I have a UserControl that is a button, with certain characteristics, and I have a window that has several of these buttons in their \"normal\" style. On this same window, I hav

3条回答
  •  再見小時候
    2021-02-09 22:45

    An alternative (more of a pure xaml) solution would be to use a default style BasedOn your named style, and adding an EventSetter for the ClickEvent:

    
        
            
        
        1
        2
        3
    
    

    A complete generic example for anyone else who runs across this answer:

    Your existing code might look like this:

    
        
            
        
        
            
                

    And you can change it to the following:

    
        
            
        
        
            
                 
                    
                
                

提交回复
热议问题