mirror of
https://github.com/holgerb83/ModernWpfPlayground.git
synced 2025-04-19 23:03:49 +02:00
Compare commits
2 Commits
b1e70f09b1
...
8c87abeb1d
Author | SHA1 | Date | |
---|---|---|---|
8c87abeb1d | |||
45370afa95 |
@ -4,6 +4,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:controls="http://wpflib.de/"
|
xmlns:controls="http://wpflib.de/"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
|
||||||
xmlns:local="clr-namespace:ModernWpfPlayground"
|
xmlns:local="clr-namespace:ModernWpfPlayground"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:prism="http://prismlibrary.com/"
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
@ -82,30 +83,34 @@
|
|||||||
<MenuItem
|
<MenuItem
|
||||||
Command="{Binding ResetViewModelCommand}"
|
Command="{Binding ResetViewModelCommand}"
|
||||||
Header="New"
|
Header="New"
|
||||||
|
Icon="{iconPacks:FontAwesome Kind=FileRegular}"
|
||||||
InputGestureText="Ctrl+N" />
|
InputGestureText="Ctrl+N" />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
Command="{Binding OpenViewModelCommand}"
|
Command="{Binding OpenViewModelCommand}"
|
||||||
Header="Open"
|
Header="Open"
|
||||||
|
Icon="{iconPacks:FontAwesome Kind=FolderOpenRegular}"
|
||||||
InputGestureText="Ctrl+O" />
|
InputGestureText="Ctrl+O" />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
Command="{Binding SaveViewModelCommand}"
|
Command="{Binding SaveViewModelCommand}"
|
||||||
Header="Save"
|
Header="Save"
|
||||||
|
Icon="{iconPacks:FontAwesome Kind=SaveRegular}"
|
||||||
InputGestureText="Ctrl+S" />
|
InputGestureText="Ctrl+S" />
|
||||||
<Separator />
|
<Separator />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
Command="{Binding CloseCommand}"
|
Command="{Binding CloseCommand}"
|
||||||
Header="Close"
|
Header="Close"
|
||||||
|
Icon="{iconPacks:FontAwesome Kind=WindowCloseRegular}"
|
||||||
InputGestureText="Alt+F4" />
|
InputGestureText="Alt+F4" />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="Edit">
|
<MenuItem Header="Edit">
|
||||||
<MenuItem Header="Copy" />
|
<MenuItem Header="Copy" Icon="{iconPacks:FontAwesome Kind=CopyRegular}" />
|
||||||
<MenuItem Header="Cut" />
|
<MenuItem Header="Cut" Icon="{iconPacks:FontAwesome Kind=CutSolid}" />
|
||||||
<MenuItem Header="Paste" />
|
<MenuItem Header="Paste" Icon="{iconPacks:FontAwesome Kind=ClipboardRegular}" />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
<MenuItem Header="Help">
|
<MenuItem Header="Help">
|
||||||
<MenuItem Header="?" />
|
<MenuItem Header="?" Icon="{iconPacks:FontAwesome Kind=QuestionCircleRegular}" />
|
||||||
<Separator />
|
<Separator />
|
||||||
<MenuItem Header="Info" />
|
<MenuItem Header="Info" Icon="{iconPacks:FontAwesome Kind=InfoSolid}" />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
<!-- Horizontally centered title -->
|
<!-- Horizontally centered title -->
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
<PackageReference Include="Prism.Wpf" Version="8.0.0.1740-pre" />
|
<PackageReference Include="Prism.Wpf" Version="8.0.0.1740-pre" />
|
||||||
<PackageReference Include="YamlDotNet" Version="8.1.2" />
|
<PackageReference Include="YamlDotNet" Version="8.1.2" />
|
||||||
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
|
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
|
||||||
|
<PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.3.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -7,6 +7,7 @@ using System.Windows.Controls;
|
|||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
using System.Windows.Documents;
|
using System.Windows.Documents;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
|
||||||
namespace Controls
|
namespace Controls
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -73,7 +74,7 @@ namespace Controls
|
|||||||
var block = new TextBlock();
|
var block = new TextBlock();
|
||||||
foreach (var tc in textComponents)
|
foreach (var tc in textComponents)
|
||||||
{
|
{
|
||||||
var run = new Run(tc.Text) { FontFamily = new FontFamily("Palatino Linotype"), FontSize = 16 };
|
var run = new Run(tc.Text) {FontFamily = new FontFamily("Palatino Linotype"), FontSize = 16};
|
||||||
switch (tc.Style)
|
switch (tc.Style)
|
||||||
{
|
{
|
||||||
case BaselineAlignment.Subscript:
|
case BaselineAlignment.Subscript:
|
||||||
@ -85,8 +86,10 @@ namespace Controls
|
|||||||
run.FontSize = 12;
|
run.FontSize = 12;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
block.Inlines.Add(run);
|
block.Inlines.Add(run);
|
||||||
}
|
}
|
||||||
|
|
||||||
block.HorizontalAlignment = HorizontalAlignment.Right;
|
block.HorizontalAlignment = HorizontalAlignment.Right;
|
||||||
block.VerticalAlignment = VerticalAlignment.Center;
|
block.VerticalAlignment = VerticalAlignment.Center;
|
||||||
return block;
|
return block;
|
||||||
@ -109,7 +112,10 @@ namespace Controls
|
|||||||
textComponents.Add(comp);
|
textComponents.Add(comp);
|
||||||
snippet.Clear();
|
snippet.Clear();
|
||||||
}
|
}
|
||||||
alignment = alignment == BaselineAlignment.Subscript ? BaselineAlignment.Baseline : BaselineAlignment.Subscript;
|
|
||||||
|
alignment = alignment == BaselineAlignment.Subscript
|
||||||
|
? BaselineAlignment.Baseline
|
||||||
|
: BaselineAlignment.Subscript;
|
||||||
break;
|
break;
|
||||||
case '^':
|
case '^':
|
||||||
if (snippet.Length > 0)
|
if (snippet.Length > 0)
|
||||||
@ -118,13 +124,17 @@ namespace Controls
|
|||||||
textComponents.Add(comp);
|
textComponents.Add(comp);
|
||||||
snippet.Clear();
|
snippet.Clear();
|
||||||
}
|
}
|
||||||
alignment = alignment == BaselineAlignment.Superscript ? BaselineAlignment.Baseline : BaselineAlignment.Superscript;
|
|
||||||
|
alignment = alignment == BaselineAlignment.Superscript
|
||||||
|
? BaselineAlignment.Baseline
|
||||||
|
: BaselineAlignment.Superscript;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
snippet.Append(c);
|
snippet.Append(c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (snippet.Length > 0)
|
if (snippet.Length > 0)
|
||||||
{
|
{
|
||||||
var comp = new TextComponent(snippet.ToString(), alignment);
|
var comp = new TextComponent(snippet.ToString(), alignment);
|
||||||
|
@ -89,10 +89,11 @@
|
|||||||
<controls:EnumToKeyValueListConverter x:Key="EnumToKeyValuePairConverter" />
|
<controls:EnumToKeyValueListConverter x:Key="EnumToKeyValuePairConverter" />
|
||||||
<DataTemplate x:Key="EnumComboBoxDataTemplate">
|
<DataTemplate x:Key="EnumComboBoxDataTemplate">
|
||||||
<ComboBox
|
<ComboBox
|
||||||
|
HorizontalAlignment="Stretch"
|
||||||
DisplayMemberPath="Key"
|
DisplayMemberPath="Key"
|
||||||
ItemsSource="{Binding Value, ElementName=LayoutRoot, Converter={StaticResource EnumToKeyValuePairConverter}}"
|
ItemsSource="{Binding Value, ElementName=LayoutRoot, Converter={StaticResource EnumToKeyValuePairConverter}}"
|
||||||
SelectedValue="{Binding Value, ElementName=LayoutRoot}"
|
SelectedValue="{Binding Value, ElementName=LayoutRoot}"
|
||||||
SelectedValuePath="Value" HorizontalAlignment="Stretch"
|
SelectedValuePath="Value"
|
||||||
Validation.ErrorTemplate="{DynamicResource ValidationErrorTemplate}"
|
Validation.ErrorTemplate="{DynamicResource ValidationErrorTemplate}"
|
||||||
Validation.ValidationAdornerSiteFor="{Binding ElementName=LayoutRoot}">
|
Validation.ValidationAdornerSiteFor="{Binding ElementName=LayoutRoot}">
|
||||||
<ComboBox.Style>
|
<ComboBox.Style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user