1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
5
using System.Windows.Controls;
6
using ICSharpCode.WpfDesign.Extensions;
8
using System.Windows.Shapes;
9
using System.Windows.Media;
11
namespace ICSharpCode.WpfDesign.Designer.Extensions.Initializers
13
[ExtensionFor(typeof(ContentControl))]
14
public class ContentControlInitializer : DefaultInitializer
16
public override void InitializeDefaults(DesignItem item)
18
DesignItemProperty contentProperty = item.Properties["Content"];
19
if (contentProperty.ValueOnInstance == null) {
20
contentProperty.SetValue(item.ComponentType.Name);
25
[ExtensionFor(typeof(HeaderedContentControl), OverrideExtension = typeof(ContentControlInitializer))]
26
public class HeaderedContentControlInitializer : DefaultInitializer
28
public override void InitializeDefaults(DesignItem item)
30
DesignItemProperty headerProperty = item.Properties["Header"];
31
if (headerProperty.ValueOnInstance == null) {
32
headerProperty.SetValue(item.ComponentType.Name);
35
DesignItemProperty contentProperty = item.Properties["Content"];
36
if (contentProperty.ValueOnInstance == null) {
37
contentProperty.SetValue(new PanelInstanceFactory().CreateInstance(typeof(Canvas)));
42
[ExtensionFor(typeof(Shape))]
43
public class ShapeInitializer : DefaultInitializer
45
public override void InitializeDefaults(DesignItem item)
47
DesignItemProperty fillProperty = item.Properties["Fill"];
48
if (fillProperty.ValueOnInstance == null) {
49
fillProperty.SetValue(Brushes.YellowGreen);