Skip to content
Permalink
Branch: master
Find file Copy path
112 lines (107 sloc) 8.04 KB
<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">
<DockPanel>
<Button
Margin="0 10 0 0"
Tag="{Binding Xaml, RelativeSource={RelativeSource TemplatedParent}}"
HorizontalAlignment="Right"
Command="Copy"
CommandParameter="{Binding Xaml, RelativeSource={RelativeSource TemplatedParent}}"
Content="_COPY"
DockPanel.Dock="Bottom"
Style="{StaticResource MaterialDesignRaisedButton}">
</Button>
<avalonEdit:TextEditor Document="{Binding Xaml, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource TextDocumentValueConverter}}"
Style="{StaticResource AvalonTextEditorXamlDisplay}" />
</DockPanel>
</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>
You can’t perform that action at this time.