|
| 1 | +<Application |
| 2 | + x:Class="MaterialDesign3Demo.App" |
| 3 | + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 4 | + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 5 | + xmlns:smtx="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML" |
| 6 | + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" |
| 7 | + xmlns:avalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit" |
| 8 | + xmlns:smtxAe="clr-namespace:ShowMeTheXAML.AvalonEdit;assembly=ShowMeTheXAML.AvalonEdit" |
| 9 | + xmlns:system="clr-namespace:System;assembly=mscorlib" |
| 10 | + xmlns:materialDesignDemo="clr-namespace:MaterialDesign3Demo" |
| 11 | + StartupUri="MainWindow.xaml"> |
| 12 | + <Application.Resources> |
| 13 | + <ResourceDictionary> |
| 14 | + <ResourceDictionary.MergedDictionaries> |
| 15 | + <!-- This is the current way to setup your app's initial theme --> |
| 16 | + <materialDesign:BundledTheme |
| 17 | + BaseTheme="Inherit" |
| 18 | + PrimaryColor="DeepPurple" |
| 19 | + SecondaryColor="Lime" |
| 20 | + ColorAdjustment="{materialDesign:ColorAdjustment}" /> |
| 21 | + |
| 22 | + <!-- If you would prefer to use your own colors there is an option for that as well --> |
| 23 | + <!--<materialDesign:CustomColorTheme BaseTheme="Light" PrimaryColor="Aqua" SecondaryColor="DarkGreen" />--> |
| 24 | + |
| 25 | + <!-- You can also use the built in theme dictionaries as well |
| 26 | + <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" /> |
| 27 | + <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" /> |
| 28 | + <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" /> |
| 29 | + --> |
| 30 | + |
| 31 | + <ResourceDictionary |
| 32 | + Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign3.Defaults.xaml" /> |
| 33 | + |
| 34 | + <ResourceDictionary |
| 35 | + Source="pack://application:,,,/ShowMeTheXAML.AvalonEdit;component/Themes/xamldisplayer.xaml" /> |
| 36 | + </ResourceDictionary.MergedDictionaries> |
| 37 | + |
| 38 | + <Style |
| 39 | + TargetType="smtx:XamlDisplay" |
| 40 | + BasedOn="{StaticResource {x:Type smtx:XamlDisplay}}"> |
| 41 | + <Style.Resources> |
| 42 | + <ResourceDictionary> |
| 43 | + <ResourceDictionary.MergedDictionaries> |
| 44 | + <ResourceDictionary |
| 45 | + Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Button.xaml" /> |
| 46 | + <ResourceDictionary |
| 47 | + Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.ToggleButton.xaml" /> |
| 48 | + </ResourceDictionary.MergedDictionaries> |
| 49 | + |
| 50 | + <smtxAe:TextDocumentValueConverter |
| 51 | + x:Key="TextDocumentValueConverter" /> |
| 52 | + </ResourceDictionary> |
| 53 | + </Style.Resources> |
| 54 | + <Setter |
| 55 | + Property="IsTabStop" |
| 56 | + Value="False" /> |
| 57 | + <Setter |
| 58 | + Property="VerticalContentAlignment" |
| 59 | + Value="Bottom" /> |
| 60 | + <Setter |
| 61 | + Property="HorizontalContentAlignment" |
| 62 | + Value="Right" /> |
| 63 | + <Setter |
| 64 | + Property="materialDesignDemo:XamlDisplayEx.ButtonDock" |
| 65 | + Value="Right" /> |
| 66 | + <Setter |
| 67 | + Property="Formatter"> |
| 68 | + <Setter.Value> |
| 69 | + <smtx:XamlFormatter |
| 70 | + NewLineOnAttributes="True" |
| 71 | + Indent=" "> |
| 72 | + <smtx:XamlFormatter.NamespacesToRemove> |
| 73 | + <system:String>http://materialdesigninxaml.net/winfx/xaml/themes</system:String> |
| 74 | + </smtx:XamlFormatter.NamespacesToRemove> |
| 75 | + </smtx:XamlFormatter> |
| 76 | + </Setter.Value> |
| 77 | + </Setter> |
| 78 | + <Setter |
| 79 | + Property="Template"> |
| 80 | + <Setter.Value> |
| 81 | + <ControlTemplate |
| 82 | + TargetType="smtx:XamlDisplay"> |
| 83 | + <DockPanel> |
| 84 | + <materialDesign:PopupBox |
| 85 | + DockPanel.Dock="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(materialDesignDemo:XamlDisplayEx.ButtonDock)}" |
| 86 | + IsTabStop="False" |
| 87 | + Padding="10" |
| 88 | + StaysOpen="True" |
| 89 | + HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" |
| 90 | + VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
| 91 | + x:Name="PopupBox"> |
| 92 | + <materialDesign:PopupBox.ToggleContent> |
| 93 | + <materialDesign:PackIcon |
| 94 | + Kind="Xml" |
| 95 | + Cursor="Hand" |
| 96 | + ToolTip="View XAML" |
| 97 | + Foreground="{DynamicResource PrimaryHueDarkBrush}" |
| 98 | + Background="Transparent" |
| 99 | + Margin="3"> |
| 100 | + <materialDesign:PackIcon.Style> |
| 101 | + <Style |
| 102 | + TargetType="materialDesign:PackIcon" |
| 103 | + BasedOn="{StaticResource {x:Type materialDesign:PackIcon}}"> |
| 104 | + <Setter |
| 105 | + Property="Opacity" |
| 106 | + Value="0.4" /> |
| 107 | + <Style.Triggers> |
| 108 | + <Trigger |
| 109 | + Property="IsMouseOver" |
| 110 | + Value="True"> |
| 111 | + <Setter |
| 112 | + Property="Opacity" |
| 113 | + Value="1" /> |
| 114 | + </Trigger> |
| 115 | + </Style.Triggers> |
| 116 | + </Style> |
| 117 | + </materialDesign:PackIcon.Style> |
| 118 | + </materialDesign:PackIcon> |
| 119 | + </materialDesign:PopupBox.ToggleContent> |
| 120 | + <Border |
| 121 | + MaxHeight="600" |
| 122 | + MaxWidth="800"> |
| 123 | + <DockPanel> |
| 124 | + <Button |
| 125 | + Margin="0 10 0 0" |
| 126 | + Tag="{Binding Xaml, RelativeSource={RelativeSource TemplatedParent}}" |
| 127 | + HorizontalAlignment="Right" |
| 128 | + Command="Copy" |
| 129 | + CommandParameter="{Binding Xaml, RelativeSource={RelativeSource TemplatedParent}}" |
| 130 | + Content="_COPY" |
| 131 | + DockPanel.Dock="Bottom" |
| 132 | + Style="{StaticResource MaterialDesignRaisedButton}"> |
| 133 | + </Button> |
| 134 | + <avalonEdit:TextEditor |
| 135 | + Document="{Binding Xaml, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource TextDocumentValueConverter}}" |
| 136 | + Style="{StaticResource AvalonTextEditorXamlDisplay}" /> |
| 137 | + </DockPanel> |
| 138 | + </Border> |
| 139 | + |
| 140 | + </materialDesign:PopupBox> |
| 141 | + <Grid> |
| 142 | + <AdornerDecorator> |
| 143 | + <Border |
| 144 | + BorderBrush="{DynamicResource SecondaryHueMidBrush}" |
| 145 | + Opacity=".4" |
| 146 | + Margin="-5"> |
| 147 | + <Border.Style> |
| 148 | + <Style |
| 149 | + TargetType="Border"> |
| 150 | + <Setter |
| 151 | + Property="BorderThickness" |
| 152 | + Value="0" /> |
| 153 | + <Style.Triggers> |
| 154 | + <DataTrigger |
| 155 | + Binding="{Binding ElementName=PopupBox, Path=IsPopupOpen}" |
| 156 | + Value="True"> |
| 157 | + <Setter |
| 158 | + Property="BorderThickness" |
| 159 | + Value="5" /> |
| 160 | + </DataTrigger> |
| 161 | + </Style.Triggers> |
| 162 | + </Style> |
| 163 | + </Border.Style> |
| 164 | + </Border> |
| 165 | + </AdornerDecorator> |
| 166 | + <ContentPresenter /> |
| 167 | + </Grid> |
| 168 | + </DockPanel> |
| 169 | + </ControlTemplate> |
| 170 | + </Setter.Value> |
| 171 | + </Setter> |
| 172 | + </Style> |
| 173 | + </ResourceDictionary> |
| 174 | + </Application.Resources> |
| 175 | +</Application> |
| 176 | + |
| 177 | + |
0 commit comments