How to Extract Default Control Template In Visual Studio?

前端 未结 6 473
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-22 09:07

I\'m wondering how I can extract (get a copy) of the Default Template of a given control using Visual Studio. I know this can be done with Expression Blend (right click a co

6条回答
  •  逝去的感伤
    2020-11-22 10:10

    One thing to keep in mind: if you already have a style defined somewhere that targets the given control then all of the above described options will be disabled. I had the following bit of code in my App.xaml file:

    
        
    
    

    I was pulling my hair out trying to figure out why the edit a copy... and convert to new resource... options described in the other answers were disabled for my Button (which was defined in a completely different file). I commented out the above style code for Button and suddenly both options weren't disabled anymore.

    Moral of the story: VS won't generate a style containing a template copy for you if a style already exists for that element anywhere in your code.

提交回复
热议问题