Professional Documents
Culture Documents
6460a 06
6460a 06
Windows® Presentation
Foundation
Module 6: Creating New Controls
• Overview of Control Authoring
• Creating Controls
Lesson: Overview of Control Authoring
• Why Create New Controls?
• User Controls
• Custom Controls
• FrameworkElement-Derived Controls
Why Create New Controls?
• Rich content
• Styles
• Control templates
• Triggers
• Data templates
Options for Creating New Controls
• Direct rendering
• Custom element composition
• Implementing Commands
namespace MyNamespace
{
public class NumericUpDown : UserControl
{
...
Implementing Properties and Events
namespace MyNamespace
{
public class NumericUpDown : Control {...}
...
<Application
xmlns:local="clr-namespace:MyNamespace" ...>
<Application.Resources>
...
<ControlTemplate
TargetType="{x:Type local:NumericUpDown}">
<Grid>
...
Implementing Commands
<ResourceDictionary ...>
<Style TargetType="{x:Type local:NumericUpDown}">
<ControlTemplate TargetType="{x:Type ...}">
...
Defined in generic.xaml
[assembly: ThemeInfo(
ResourceDictionaryLocation.None,
ResourceDictionaryLocation.SourceAssembly)]
Logon information
Virtual machine 6460A-LON-DEV-06
Password Pa$$w0rd
• Best Practices