1- using ICSharpCode . AvalonEdit ;
1+ // Licensed to the .NET Foundation under one or more agreements.
2+ // The .NET Foundation licenses this file to you under the MIT license.
3+ // See the LICENSE file in the project root for more information.
4+
5+ using ICSharpCode . AvalonEdit ;
26using MahApps . Demo . Core ;
3- using System ;
4- using System . Collections . Generic ;
57using System . Collections . ObjectModel ;
68using System . Diagnostics ;
7- using System . Linq ;
8- using System . Text ;
9- using System . Threading . Tasks ;
109using System . Windows ;
1110using System . Windows . Controls ;
1211
@@ -22,12 +21,10 @@ public class DemoView : HeaderedContentControl
2221
2322 /// <summary>Identifies the <see cref="HyperlinkOnlineDocs"/> dependency property.</summary>
2423 public static readonly DependencyProperty HyperlinkOnlineDocsProperty = DependencyProperty . Register ( nameof ( HyperlinkOnlineDocs ) , typeof ( string ) , typeof ( DemoView ) , new PropertyMetadata ( null ) ) ;
25-
26-
2724
2825 public DemoView ( )
2926 {
30- DemoProperties . CollectionChanged += DemoProperties_CollectionChanged ;
27+ this . DemoProperties . CollectionChanged += this . DemoProperties_CollectionChanged ;
3128 }
3229
3330 public ObservableCollection < DemoViewProperty > DemoProperties { get ; } = new ObservableCollection < DemoViewProperty > ( ) ;
@@ -38,43 +35,42 @@ private void DemoProperties_CollectionChanged(object sender, System.Collections.
3835 {
3936 foreach ( DemoViewProperty item in e . NewItems )
4037 {
41- item . PropertyChanged += DemoProperties_ItemPropertyChanged ;
38+ item . PropertyChanged += this . DemoProperties_ItemPropertyChanged ;
4239 }
4340 }
41+
4442 if ( e . OldItems != null )
4543 {
4644 foreach ( DemoViewProperty item in e . OldItems )
4745 {
48- item . PropertyChanged -= DemoProperties_ItemPropertyChanged ;
46+ item . PropertyChanged -= this . DemoProperties_ItemPropertyChanged ;
4947 }
5048 }
5149 }
5250
5351 private void DemoProperties_ItemPropertyChanged ( object sender , System . ComponentModel . PropertyChangedEventArgs e )
5452 {
55- SetExampleXaml ( ) ;
53+ this . SetExampleXaml ( ) ;
5654 }
5755
58-
59-
6056 public string ExampleXaml
6157 {
62- get { return ( string ) GetValue ( ExampleXamlProperty ) ; }
63- set { SetValue ( ExampleXamlProperty , value ) ; }
58+ get => ( string ) this . GetValue ( ExampleXamlProperty ) ;
59+ set => this . SetValue ( ExampleXamlProperty , value ) ;
6460 }
6561
6662 private void SetExampleXaml ( )
6763 {
68- if ( PART_AvalonEdit != null )
64+ if ( this . PART_AvalonEdit != null )
6965 {
70- var exampleText = ExampleXaml ;
66+ var exampleText = this . ExampleXaml ;
7167
72- foreach ( var item in DemoProperties )
68+ foreach ( var item in this . DemoProperties )
7369 {
7470 exampleText = exampleText . Replace ( $ "[{ item . PropertyName } ]", item . GetExampleXamlContent ( ) ) ;
7571 }
7672
77- PART_AvalonEdit . Text = exampleText ;
73+ this . PART_AvalonEdit . Text = exampleText ;
7874 }
7975 }
8076
@@ -88,8 +84,8 @@ private static void OnExampleXamlChanged(DependencyObject d, DependencyPropertyC
8884
8985 public string HyperlinkOnlineDocs
9086 {
91- get { return ( string ) GetValue ( HyperlinkOnlineDocsProperty ) ; }
92- set { SetValue ( HyperlinkOnlineDocsProperty , value ) ; }
87+ get => ( string ) this . GetValue ( HyperlinkOnlineDocsProperty ) ;
88+ set => this . SetValue ( HyperlinkOnlineDocsProperty , value ) ;
9389 }
9490
9591 public SimpleCommand NavigateToOnlineDocs { get ; } = new SimpleCommand (
@@ -100,9 +96,8 @@ public override void OnApplyTemplate()
10096 {
10197 base . OnApplyTemplate ( ) ;
10298
103- PART_AvalonEdit = GetTemplateChild ( nameof ( PART_AvalonEdit ) ) as TextEditor ;
104- SetExampleXaml ( ) ;
99+ this . PART_AvalonEdit = this . GetTemplateChild ( nameof ( this . PART_AvalonEdit ) ) as TextEditor ;
100+ this . SetExampleXaml ( ) ;
105101 }
106-
107102 }
108- }
103+ }
0 commit comments