1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
<Application x:Class="MaterialDesignColors.WpfExample.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:showMeTheXaml="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit"
xmlns:smtxAe="clr-namespace:ShowMeTheXAML.AvalonEdit;assembly=ShowMeTheXAML.AvalonEdit"
xmlns:system="clr-namespace:System;assembly=mscorlib"
xmlns:materialDesignDemo="clr-namespace:MaterialDesignDemo"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
<ResourceDictionary Source="pack://application:,,,/ShowMeTheXAML.AvalonEdit;component/Themes/xamldisplayer.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style TargetType="showMeTheXaml:XamlDisplay" BasedOn="{StaticResource {x:Type showMeTheXaml:XamlDisplay}}">
<Style.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ToggleButton.xaml" />
</ResourceDictionary.MergedDictionaries>
<smtxAe:TextDocumentValueConverter x:Key="TextDocumentValueConverter"/>
</ResourceDictionary>
</Style.Resources>
<Setter Property="VerticalContentAlignment" Value="Bottom" />
<Setter Property="HorizontalContentAlignment" Value="Right" />
<Setter Property="materialDesignDemo:XamlDisplayEx.ButtonDock" Value="Right" />
<Setter Property="Formatter">
<Setter.Value>
<showMeTheXaml:XamlFormatter NewLineOnAttributes="True" Indent=" ">
<showMeTheXaml:XamlFormatter.NamespacesToRemove>
<system:String>http://materialdesigninxaml.net/winfx/xaml/themes</system:String>
</showMeTheXaml:XamlFormatter.NamespacesToRemove>
</showMeTheXaml:XamlFormatter>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="showMeTheXaml:XamlDisplay">
<DockPanel>
<materialDesign:PopupBox DockPanel.Dock="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(materialDesignDemo:XamlDisplayEx.ButtonDock)}"
Padding="10" StaysOpen="True" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
x:Name="PopupBox">
<materialDesign:PopupBox.ToggleContent>
<materialDesign:PackIcon Kind="Xaml" Cursor="Hand" ToolTip="View XAML"
Foreground="{DynamicResource PrimaryHueDarkBrush}"
Background="Transparent"
Margin="3">
<materialDesign:PackIcon.Style>
<Style TargetType="materialDesign:PackIcon" BasedOn="{StaticResource {x:Type materialDesign:PackIcon}}">
<Setter Property="Opacity" Value="0.2" />
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="1" />
</Trigger>
</Style.Triggers>
</Style>
</materialDesign:PackIcon.Style>
</materialDesign:PackIcon>
</materialDesign:PopupBox.ToggleContent>
<Border MaxHeight="600" MaxWidth="800">
<StackPanel>
<avalonEdit:TextEditor Document="{Binding Xaml, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource TextDocumentValueConverter}}"
Style="{StaticResource AvalonTextEditorXamlDisplay}" />
<Button
Margin="0 10 0 0"
Tag="{Binding Xaml, RelativeSource={RelativeSource TemplatedParent}}"
HorizontalAlignment="Right"
Command="Copy"
CommandParameter="{Binding Xaml, RelativeSource={RelativeSource TemplatedParent}}"
Content="_COPY"
Style="{StaticResource MaterialDesignRaisedButton}">
</Button>
</StackPanel>
</Border>
</materialDesign:PopupBox>
<Grid>
<AdornerDecorator>
<Border BorderBrush="{DynamicResource SecondaryAccentBrush}" Opacity=".4" Margin="-5">
<Border.Style>
<Style TargetType="Border">
<Setter Property="BorderThickness" Value="0" />
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=PopupBox, Path=IsPopupOpen}" Value="True">
<Setter Property="BorderThickness" Value="5" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
</Border>
</AdornerDecorator>
<ContentPresenter />
</Grid>
</DockPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
|