Wpf replace template part




















Download Microsoft Edge More info. Contents Exit focus mode. Please rate your experience Yes No. Any additional feedback?

The interesting part is the GetTemplateChild method, that's looking for a Rectangle control named "BackgroundGradient". BTW, it's easier if you define custom controls in a separate project, so create a new "Silverlight class library" project if you haven't already done so and put it into that project. Then add a new resource dictionary file and override the control template and make sure you have a rectangle named "BackgroundGradient".

In this case we're using the standard button control template that I've cut down a bit:. I presume you could get get even more clever and pass through a resource name or a style name and load it dynamically.

I would redesign your template to be a Custom Control, using ContentPresenters as placeholders for the elements that will change. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?

Collectives on Stack Overflow. Learn more. Asked 11 years, 11 months ago. Active 1 year, 10 months ago. Viewed 23k times. Improve this question. Dave Clemmer 3, 12 12 gold badges 48 48 silver badges 72 72 bronze badges. Christian Ruppert Christian Ruppert 3, 5 5 gold badges 43 43 silver badges 72 72 bronze badges.

Add a comment. You deserve a medal. Great solution! Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Making Agile work for data science. Stack Gives Back Featured on Meta. View all page feedback. In this article. The container for the element that indicates the position of the ScrollBar.

The control uses the Validation class and the Validation. HasError attached property is false. The Validation.



0コメント

  • 1000 / 1000