Skip to content

Commit 98a6c5d

Browse files
committed
reinstate file
1 parent 2471fa8 commit 98a6c5d

File tree

1 file changed

+50
-0
lines changed
  • snippets/csharp/System.Windows/DependencyProperty/DefaultMetadata/XamlApp

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+

2+
using System;
3+
using System.Windows;
4+
using System.Collections;
5+
using System.Windows.Media;
6+
using System.Windows.Controls;
7+
using System.Windows.Shapes;
8+
using System.Windows.Navigation;
9+
using System.Text;
10+
11+
namespace SDKSample {
12+
public partial class XAMLAPP{
13+
void ReportState(object sender, EventArgs e)
14+
{
15+
StringBuilder sb = new StringBuilder();
16+
TextBlock tb = new TextBlock();
17+
//<SnippetGetMetadataInit>
18+
PropertyMetadata pm;
19+
//</SnippetGetMetadataInit>
20+
sb.Append("MyStateControl State default = ");
21+
//<SnippetGetMetadataType>
22+
pm = MyStateControl.StateProperty.GetMetadata(typeof(MyStateControl));
23+
//</SnippetGetMetadataType>
24+
sb.Append(pm.DefaultValue.ToString());
25+
sb.Append("\n");
26+
sb.Append("UnrelatedStateControl State default = ");
27+
//<SnippetGetMetadataDOType>
28+
DependencyObjectType dt = unrelatedInstance.DependencyObjectType;
29+
pm = UnrelatedStateControl.StateProperty.GetMetadata(dt);
30+
//</SnippetGetMetadataDOType>
31+
sb.Append(pm.DefaultValue.ToString());
32+
sb.Append("\n");
33+
sb.Append("MyAdvancedStateControl State default = ");
34+
//<SnippetGetMetadataDOInstance>
35+
pm = MyAdvancedStateControl.StateProperty.GetMetadata(advancedInstance);
36+
//</SnippetGetMetadataDOInstance>
37+
sb.Append(pm.GetType().ToString());
38+
sb.Append("\n");
39+
//</SnippetDefaultMetadataDOInstance>
40+
tb.Text = sb.ToString();
41+
root.Children.Add(tb);
42+
}
43+
void NavPage2(object sender, RoutedEventArgs e)
44+
{
45+
Application currentApp = Application.Current;
46+
NavigationWindow nw = currentApp.Windows[0] as NavigationWindow;
47+
nw.Source = new Uri("page2.xaml", UriKind.RelativeOrAbsolute);
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)