Live Chat Icon For mobile
Live Chat Icon

How can I create Four Button controls with the contents set to a String, a DateTimeObject, an UIElement and A Panel that contains other UIElement objects?

Platform: WPF| Category: Templates

The example Extensible Application Markup Language (XAML) version could use the <Button.Content> tags around the content of each button, but it is not necessary. The Four buttons can be created as follows.


<!--Create a Button with a string as its content.-->
<Button>This is string content of a Button</Button>

<!--Create a Button with a DateTime object as its content.-->
<Button xmlns:sys='clr-namespace:System;assembly=mscorlib'>
  <sys:DateTime>2004/3/4 13:6:55</sys:DateTime>

<!--Create a Button with a single UIElement as its content.-->
  <Rectangle Height='40' Width='40' Fill='Blue'/>

<!--Create a Button with a panel that contains multiple objects 
as its content.-->
    <Ellipse Height='40' Width='40' Fill='Blue'/>
    <TextBlock TextAlignment='Center'>Button</TextBlock>

Share with

Related FAQs

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

Please submit your question and answer.