Skip to content

Commit

Permalink
Update file headers and format code
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Aug 12, 2020
1 parent 40e3e4d commit fcc4ad2
Show file tree
Hide file tree
Showing 19 changed files with 229 additions and 266 deletions.
12 changes: 6 additions & 6 deletions src/MahApps.Metro.Demo_v2/App.xaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Application x:Class="MahApps.Metro.Demo_v2.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MahApps.Metro.Demo_v2"
xmlns:avalon="http://icsharpcode.net/sharpdevelop/avalonedit"
xmlns:local="clr-namespace:MahApps.Metro.Demo_v2"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
Expand All @@ -16,19 +16,19 @@
</ResourceDictionary.MergedDictionaries>

<Style BasedOn="{StaticResource {x:Type avalon:TextArea}}" TargetType="{x:Type avalon:TextArea}">
<Setter Property="SelectionBrush">
<Setter Property="SelectionBorder">
<Setter.Value>
<SolidColorBrush Opacity="0.7" Color="{DynamicResource MahApps.Colors.Highlight}" />
<Pen Brush="{DynamicResource MahApps.Brushes.Highlight}" Thickness="1" />
</Setter.Value>
</Setter>
<Setter Property="SelectionBorder">
<Setter Property="SelectionBrush">
<Setter.Value>
<Pen Brush="{DynamicResource MahApps.Brushes.Highlight}" Thickness="1" />
<SolidColorBrush Opacity="0.7" Color="{DynamicResource MahApps.Colors.Highlight}" />
</Setter.Value>
</Setter>
<Setter Property="SelectionForeground" Value="{DynamicResource MahApps.Brushes.IdealForeground}" />
</Style>

</ResourceDictionary>
</Application.Resources>
</Application>
12 changes: 5 additions & 7 deletions src/MahApps.Metro.Demo_v2/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Windows;

namespace MahApps.Metro.Demo_v2
Expand All @@ -14,4 +12,4 @@ namespace MahApps.Metro.Demo_v2
public partial class App : Application
{
}
}
}
14 changes: 9 additions & 5 deletions src/MahApps.Metro.Demo_v2/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
47 changes: 21 additions & 26 deletions src/MahApps.Metro.Demo_v2/Controls/DemoView.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using ICSharpCode.AvalonEdit;
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using ICSharpCode.AvalonEdit;
using MahApps.Demo.Core;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;

Expand All @@ -22,12 +21,10 @@ public class DemoView : HeaderedContentControl

/// <summary>Identifies the <see cref="HyperlinkOnlineDocs"/> dependency property.</summary>
public static readonly DependencyProperty HyperlinkOnlineDocsProperty = DependencyProperty.Register(nameof(HyperlinkOnlineDocs), typeof(string), typeof(DemoView), new PropertyMetadata(null));



public DemoView()
{
DemoProperties.CollectionChanged += DemoProperties_CollectionChanged;
this.DemoProperties.CollectionChanged += this.DemoProperties_CollectionChanged;
}

public ObservableCollection<DemoViewProperty> DemoProperties { get; } = new ObservableCollection<DemoViewProperty>();
Expand All @@ -38,43 +35,42 @@ private void DemoProperties_CollectionChanged(object sender, System.Collections.
{
foreach (DemoViewProperty item in e.NewItems)
{
item.PropertyChanged += DemoProperties_ItemPropertyChanged;
item.PropertyChanged += this.DemoProperties_ItemPropertyChanged;
}
}

if (e.OldItems != null)
{
foreach (DemoViewProperty item in e.OldItems)
{
item.PropertyChanged -= DemoProperties_ItemPropertyChanged;
item.PropertyChanged -= this.DemoProperties_ItemPropertyChanged;
}
}
}

private void DemoProperties_ItemPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
SetExampleXaml();
this.SetExampleXaml();
}



public string ExampleXaml
{
get { return (string)GetValue(ExampleXamlProperty); }
set { SetValue(ExampleXamlProperty, value); }
get => (string)this.GetValue(ExampleXamlProperty);
set => this.SetValue(ExampleXamlProperty, value);
}

private void SetExampleXaml()
{
if (PART_AvalonEdit != null)
if (this.PART_AvalonEdit != null)
{
var exampleText = ExampleXaml;
var exampleText = this.ExampleXaml;

foreach (var item in DemoProperties)
foreach (var item in this.DemoProperties)
{
exampleText = exampleText.Replace($"[{item.PropertyName}]", item.GetExampleXamlContent());
}

PART_AvalonEdit.Text = exampleText;
this.PART_AvalonEdit.Text = exampleText;
}
}

Expand All @@ -88,8 +84,8 @@ private static void OnExampleXamlChanged(DependencyObject d, DependencyPropertyC

public string HyperlinkOnlineDocs
{
get { return (string)GetValue(HyperlinkOnlineDocsProperty); }
set { SetValue(HyperlinkOnlineDocsProperty, value); }
get => (string)this.GetValue(HyperlinkOnlineDocsProperty);
set => this.SetValue(HyperlinkOnlineDocsProperty, value);
}

public SimpleCommand NavigateToOnlineDocs { get; } = new SimpleCommand(
Expand All @@ -100,9 +96,8 @@ public override void OnApplyTemplate()
{
base.OnApplyTemplate();

PART_AvalonEdit = GetTemplateChild(nameof(PART_AvalonEdit)) as TextEditor;
SetExampleXaml();
this.PART_AvalonEdit = this.GetTemplateChild(nameof(this.PART_AvalonEdit)) as TextEditor;
this.SetExampleXaml();
}

}
}
}
Loading

0 comments on commit fcc4ad2

Please sign in to comment.