Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
XAML TextBox
WhatsApp
Mahesh Chand
6y
24.5k
0
4
100
Article
The
element in XAML represents a TextBox control.
The following code sets a TextBox control properties in XAML.
The following code snippet sets controls location by the Margin, VerticalAlignment and HorizontalAlignment properties.
<
TextBox
Name
=
"TextBox1"
Height
=
"30"
Width
=
"200"
Text
=
"Hello! I am a TextBox."
Margin
=
"10,10,0,0"
VerticalAlignment
=
"Top"
HorizontalAlignment
=
"Left"
>
</
TextBox
>
You can set the border of a TextBox by using the BorderBrush property.
<
TextBox.BorderBrush
>
<
LinearGradientBrush
StartPoint
=
"0,0"
EndPoint
=
"1,1"
>
<
GradientStop
Color
=
"Blue"
Offset
=
"0"
/>
<
GradientStop
Color
=
"Red"
Offset
=
"1.0"
/>
</
LinearGradientBrush
>
</
TextBox.BorderBrush
>
The Background and Foreground properties of the TextBox set the background and foreground colors of a TextBox.
<
TextBox.Background
>
<
LinearGradientBrush
StartPoint
=
"0,0"
EndPoint
=
"1,1"
>
<
GradientStop
Color
=
"Blue"
Offset
=
"0.1"
/>
<
GradientStop
Color
=
"Orange"
Offset
=
"0.25"
/>
<
GradientStop
Color
=
"Green"
Offset
=
"0.75"
/>
<
GradientStop
Color
=
"Red"
Offset
=
"1.0"
/>
</
LinearGradientBrush
>
</
TextBox.Background
>
<
TextBox.Foreground
>
<
LinearGradientBrush
StartPoint
=
"0,0"
EndPoint
=
"1,1"
>
<
GradientStop
Color
=
"Orange"
Offset
=
"0.25"
/>
<
GradientStop
Color
=
"White"
Offset
=
"1.0"
/>
</
LinearGradientBrush
>
</
TextBox.Foreground
>
To avoid duplicate content, this article has move here:
WPF TextBox Tutorial
XAML TextBox
TextBox elememt
XAML Text Box
Up Next
Ebook Download
View all
Programming XAML
Read by 12.3k people
Download Now!
Learn
View all
Mindcracker
Founded in 2003, Mindcracker is the authority in custom software development and innovation. We put best practices into action. We deliver solutions based on consumer and industry analysis.
Membership not found