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