In Focus
Kolkata Chapter Developer Day: May 25
C# Corner Delhi Chapter Meet, May-18, 2013 Official Recap
Istanbul Chapter May 2013 2nd Seminar Announced : Learn WinJS, Windows Store, MVC
ANNOUNCEMENT: April 2013 Month Winners
Email :
Password :
Remember me?
Forgot password
Contribute
An Article
A Blog
A News
A Video
A Link
An Interview Question
Ask a Question
TECHNOLOGIES
.NET 4.5
Current Affairs
Learn .NET
SharePoint 2010
Web Development
.NET Assemblies
Databases & DBA
LightSwitch 2012
SharePoint 2013
Web Services in C#
ADO.NET in C#
Design & Architecture
LINQ
Silverlight with C#
Windows 8
AJAX in C#
Exception Handling C#
Mobile & Embedded
Smart Devices
Windows Azure
Android Programming
Graphics Design
Office 2013
SQL
Windows Controls C#
Articles C#
Hardware
OOP/OOD
SQL Server 2012
Windows Forms C#
ASP.NET Controls in C#
How do I
Operating Systems
Testing
Windows Phone 8
ASP.NET MVC with C#
HTML 5
PHP
TypeScript
Windows Server 2012
ASP.NET Programming
Internet & Web
Products
Visual C#
Windows Store Apps
C# Language
iPhone/iPad
Project Management
Visual Studio .NET
Workflow Foundation in C#
C# Tutorials
Java
Reports using C#
Visual Studio 2010
WPF
C, C++, MFC
Java and .NET
Robotics & Hardware
Visual Studio 2012
XAML
Career Advice
JavaScript, CSS
Security in .NET
WCF with C#
XML
Chapters
JQuery
Request a new Category
|
View All
ANSWERS
BLOGS
VIDEOS
INTERVIEWS
BOOKS
LINKS
NEWS
CHAPTERS
CAREER ADVICE
Making your Web Browser in C#
HTML 5 vs Native Apps
Secure Your Android Application from Hackers
Why to fear Object Oriented Programming approach
Check upcoming B'day in Asp.net
Happy Birthday Destin Joy
Class vs Structure
Compare strings using StringComparison.Ordin ...
Access Master Page Control In Child Page
Popup Example in WPF
Blog
WPF: Control Template that is customized by properties
Posted by
Nipun Tomar
in
Blogs
|
WPF
on
Dec 15, 2011
The following example demonstrates a window that defines a custom ControlTemplate
Tweet
3585
0
0
The following example demonstrates a window that defines a custom ControlTemplate for the System.Windows.Controls.Label control. Within the ControlTemplate there is a System.Windows.Controls.Border control that uses the TemplateBinding markup extension to declare that its Background property should derive its value from the Background property of the Label element, which in this case is set to LightBlue.
For Example:
<
Window
x
:
Class
="ControlTemplate.Window1"
xmlns
=
http://schemas.microsoft.com/winfx/2006/xaml/presentation
xmlns
:
x
=
http://schemas.microsoft.com/winfx/2006/xaml
Title
="ControlTemplate"
Height
="100"
Width
="180">
<
Window.Resources
>
<
ControlTemplate
x
:
Key
="labelTemplate"
TargetType
="{
x
:
Type
Label
}">
<
Border
x
:
Name
="border"
CornerRadius
="4"
BorderThickness
="3"
BorderBrush
="DarkGray"
Background
="{
TemplateBinding
Property
=Background}">
<
ContentPresenter
HorizontalAlignment
="Center"
VerticalAlignment
="Center"/>
</
Border
>
</
ControlTemplate
>
</
Window.Resources
>
<
Grid
>
<
Label
Width
="100"
Height
="24"
Margin
="4"
Content
="Custom Label"
Template
="{
StaticResource
labelTemplate
}"
Background
="LightBlue"/>
</
Grid
>
</
Window
>
This Feature is Sponsored By
DynamicPDF Merger is a developers dream for interacting with any existing PDF documents. Merge, append, split, form fill, flatten stamp and so much more.
WPF: How to display content in a..
What is WPF?
post comment
COMMENT USING
PREMIUM SPONSORS
iPhone, Android & Web Development Services
Over-C is a holistic consortium of communications and technology specialists. We build, deploy and market both business as well as consumer products and solutions.
More Blogs from this Blogger
How to reset Dock in MAC OS
How to list all properties of an Entity
WPF XAML content with special character
WPF: Textblock Vs Label
Show/hide Solution and Advanced Build Configurations
Recycle IIS Application Pool
How To Disable All Triggers on a Database
How to get all dates between date range in sql query
Difference between URL and URI
Difference between RDL and RDLC formats
View All
SPONSORED BY
DynamicPDF ReportWriter Suite
PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Follow @twitterapi
Latest Blogs
Android Studio not Starting Up After Installation
Check upcoming B'day in Asp.net
Get The Value From DataGridView To TextBox On c#
How to set Date Range and Restrict Date in jQuery?
Get Meta Data Of DLL File In Visula Studio
What is jQuery holdReady ?
Making your Web Browser in C#
Compare strings using StringComparison.OrdinalIgnoreCase
How to write or create a text file in C#
Binding Text of One controls with another in WPF
View All
Poll
Result
All Polls
What is the best product to build Mobile apps?
What is the best product to build Mobile apps
PhoneGap
Icenium
Xamarin Studio
KendoUI Mobile
JQueryMobile
Native iOS/Android
What is the best product to build Mobile apps
Options
Votes
%
PhoneGap
0
0.00
Icenium
0
0.00
Xamarin Studio
0
0.00
KendoUI Mobile
0
0.00
JQueryMobile
57
95.00
Native iOS/Android
3
5.00
Total
60
100%