Live Chat Icon For mobile
Live Chat Icon

Can I create a ContentTemplate and apply the template to a ContentControl ?

Platform: WPF| Category: Templates

The following code shows how the content template can be created and applied to a content control.

<DataTemplate x:Key='template1'>
  <TextBlock Text='{Binding}' FontSize='12' FontWeight='Bold' TextWrapping='Wrap'></TextBlock>

The above code can be applied as follows.


<Button ContentTemplate='{StaticResource template1}' Content='Click'>

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.