Reputation: 6317
I have a question regarding template parts. I want to create a control that inherits from ChildWindow, but I don't want it to have a border, OK/Close buttons, etc.
Is it an acceptable practice to remove the template parts that I don't want? I have created a copy of the ChildWindow template in Blend and removed the template parts, and it works fine - I just want to make sure that that won't cause any problems down the road.
Thanks, Charles
Upvotes: 0
Views: 127
Reputation: 12216
If you read some of the custom control development documentation on MSDN it specifically mentions that developers should anticipate that template parts may not exist and code for it, so I think you're Ok there. Personally, when I need to remove template parts I prefer to leave them in the Xaml but set Visibility = Collapsed for something like a button or BorderWidth = 0 for something like a Border. Personal preference I suppose.
Upvotes: 2