{"id":520,"date":"2019-12-07T11:06:47","date_gmt":"2019-12-07T02:06:47","guid":{"rendered":"http:\/\/marius.main.jp\/software\/blog\/?p=520"},"modified":"2020-08-10T20:24:39","modified_gmt":"2020-08-10T11:24:39","slug":"post-520","status":"publish","type":"post","link":"https:\/\/todosoft.net\/blog\/?p=520","title":{"rendered":"\u3088\u304f\u4f7f\u3046\u521d\u671f\u74b0\u5883"},"content":{"rendered":"\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">App.xaml<\/h2>\n\n\n\n<pre class=\"wp-block-luxe-blocks-syntaxhighlighter line-numbers language-csharp\"><code class=\"language-csharp\">&lt;Application x:Class=\"SampleApp.App\"\n             xmlns=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation\"\n             xmlns:x=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\"\n             xmlns:local=\"clr-namespace:SampleApp\"\n             StartupUri=\"ViewMainView.xaml\">\n    &lt;Application.Resources>\n\n        &lt;ResourceDictionary>\n            &lt;ResourceDictionary.MergedDictionaries>\n                &lt;!--MahApps-->\n                &lt;ResourceDictionary Source=\"pack:\/\/application:,,,\/MahApps.Metro;component\/Styles\/Controls.xaml\"\/>\n                &lt;ResourceDictionary Source=\"pack:\/\/application:,,,\/MahApps.Metro;component\/Styles\/Fonts.xaml\"\/>\n                &lt;ResourceDictionary Source=\"pack:\/\/application:,,,\/MahApps.Metro;component\/Styles\/Colors.xaml\"\/>\n                &lt;ResourceDictionary Source=\"pack:\/\/application:,,,\/MahApps.Metro;component\/Styles\/Accents\/BaseLight.xaml\"\/>\n\n                &lt;!--Material Design-->\n                &lt;ResourceDictionary Source=\"pack:\/\/application:,,,\/MaterialDesignThemes.Wpf;component\/Themes\/MaterialDesignTheme.Light.xaml\" \/>\n                &lt;ResourceDictionary Source=\"pack:\/\/application:,,,\/MaterialDesignThemes.Wpf;component\/Themes\/MaterialDesignTheme.Defaults.xaml\" \/>\n                &lt;ResourceDictionary Source=\"pack:\/\/application:,,,\/MaterialDesignColors;component\/Themes\/Recommended\/Primary\/MaterialDesignColor.Indigo.xaml\" \/>\n                &lt;ResourceDictionary Source=\"pack:\/\/application:,,,\/MaterialDesignColors;component\/Themes\/Recommended\/Accent\/MaterialDesignColor.Indigo.xaml\" \/>\n\n                &lt;ResourceDictionary Source=\"pack:\/\/application:,,,\/MaterialDesignThemes.Wpf;component\/Themes\/MaterialDesignTheme.PopupBox.xaml\" \/>\n\n                &lt;!--Material Design: MahApps\u7d71\u5408\u8a2d\u5b9a -->\n                &lt;ResourceDictionary Source=\"pack:\/\/application:,,,\/MaterialDesignThemes.MahApps;component\/Themes\/MaterialDesignTheme.MahApps.Defaults.xaml\"\/>\n            &lt;\/ResourceDictionary.MergedDictionaries>\n\n            &lt;!-- MahApps Brushes -->\n            &lt;SolidColorBrush x:Key=\"HighlightBrush\" Color=\"{DynamicResource Primary700}\"\/>\n            &lt;SolidColorBrush x:Key=\"AccentColorBrush\" Color=\"{DynamicResource Primary500}\"\/>\n            &lt;SolidColorBrush x:Key=\"AccentColorBrush2\" Color=\"{DynamicResource Primary400}\"\/>\n            &lt;SolidColorBrush x:Key=\"AccentColorBrush3\" Color=\"{DynamicResource Primary300}\"\/>\n            &lt;SolidColorBrush x:Key=\"AccentColorBrush4\" Color=\"{DynamicResource Primary200}\"\/>\n            &lt;SolidColorBrush x:Key=\"WindowTitleColorBrush\" Color=\"{DynamicResource Primary700}\"\/>\n            &lt;SolidColorBrush x:Key=\"AccentSelectedColorBrush\" Color=\"{DynamicResource Primary500Foreground}\"\/>\n            &lt;LinearGradientBrush x:Key=\"ProgressBrush\" EndPoint=\"0.001,0.5\" StartPoint=\"1.002,0.5\">\n                &lt;GradientStop Color=\"{DynamicResource Primary700}\" Offset=\"0\"\/>\n                &lt;GradientStop Color=\"{DynamicResource Primary300}\" Offset=\"1\"\/>\n            &lt;\/LinearGradientBrush>\n            &lt;SolidColorBrush x:Key=\"CheckmarkFill\" Color=\"{DynamicResource Primary500}\"\/>\n            &lt;SolidColorBrush x:Key=\"RightArrowFill\" Color=\"{DynamicResource Primary500}\"\/>\n            &lt;SolidColorBrush x:Key=\"IdealForegroundColorBrush\" Color=\"{DynamicResource Primary500Foreground}\"\/>\n            &lt;SolidColorBrush x:Key=\"IdealForegroundDisabledBrush\" Color=\"{DynamicResource Primary500}\" Opacity=\"0.4\"\/>\n        &lt;\/ResourceDictionary>\n\n    &lt;\/Application.Resources>\n&lt;\/Application>\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">ViewMainView.xaml<\/h2>\n\n\n\n<pre class=\"wp-block-luxe-blocks-syntaxhighlighter line-numbers language-csharp\"><code class=\"language-csharp\">&lt;Controls:MetroWindow x:Class=\"SampleApp.View.MainView\"\n        xmlns=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation\"\n        xmlns:x=\"http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\"\n        xmlns:d=\"http:\/\/schemas.microsoft.com\/expression\/blend\/2008\"\n        xmlns:mc=\"http:\/\/schemas.openxmlformats.org\/markup-compatibility\/2006\"\n        xmlns:ei=\"http:\/\/schemas.microsoft.com\/xaml\/behaviors\"\n        xmlns:i=\"http:\/\/schemas.microsoft.com\/xaml\/behaviors\"\n        xmlns:l=\"http:\/\/schemas.livet-mvvm.net\/2011\/wpf\"\n        xmlns:local=\"clr-namespace:SampleApp.View\"\n        xmlns:vm=\"clr-namespace:SampleApp.ViewModel\"\n        xmlns:system=\"clr-namespace:System;assembly=mscorlib\"\n        xmlns:materialDesign=\"http:\/\/materialdesigninxaml.net\/winfx\/xaml\/themes\"\n        xmlns:Controls=\"clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro\"\n        xmlns:Dialog=\"clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro\"\n        mc:Ignorable=\"d\"\n        TextElement.Foreground=\"{DynamicResource MaterialDesignBody}\"\n        TextElement.FontWeight=\"Regular\"\n        TextElement.FontSize=\"13\"\n        TextOptions.TextFormattingMode=\"Ideal\" \n        TextOptions.TextRenderingMode=\"Auto\"        \n        Background=\"{DynamicResource MaterialDesignPaper}\"\n        FontFamily=\"{DynamicResource MaterialDesignFont}\"\n        ResizeMode=\"CanResizeWithGrip\"\n        WindowStartupLocation=\"CenterScreen\"\n        GlowBrush=\"{DynamicResource AccentColorBrush}\"\n        WindowTransitionsEnabled=\"False\"\n        TitleCharacterCasing=\"Normal\"\n        ShowIconOnTitleBar=\"True\"\n        Dialog:DialogParticipation.Register=\"{Binding}\"\n        Title=\"MainView\" Height=\"450\" Width=\"800\">\n\n    &lt;Window.DataContext>\n        &lt;vm:MainViewModel>\n            &lt;vm:MainViewModel.MahAppsDialogCoordinator>\n                &lt;Dialog:DialogCoordinator\/>\n            &lt;\/vm:MainViewModel.MahAppsDialogCoordinator>\n        &lt;\/vm:MainViewModel>\n    &lt;\/Window.DataContext>\n\n    &lt;i:Interaction.Triggers>\n        &lt;i:EventTrigger EventName =\"ContentRendered\">\n            &lt;l:LivetCallMethodAction MethodTarget=\"{Binding}\" MethodName=\"OnContentRendered\" \/>\n        &lt;\/i:EventTrigger>\n        &lt;l:InteractionMessageTrigger Messenger=\"{Binding Messenger}\" MessageKey=\"Information\">\n            &lt;l:InformationDialogInteractionMessageAction InvokeActionOnlyWhenWindowIsActive=\"False\" \/>\n        &lt;\/l:InteractionMessageTrigger>\n    &lt;\/i:Interaction.Triggers>\n\n    &lt;Grid>\n        &lt;Button Content=\"Test\">\n            &lt;i:Interaction.Triggers>\n                &lt;i:EventTrigger EventName=\"Click\">\n                    &lt;l:LivetCallMethodAction MethodTarget=\"{Binding}\" MethodName=\"OnButtonClicked\" \/>\n                &lt;\/i:EventTrigger>\n            &lt;\/i:Interaction.Triggers>\n        &lt;\/Button>\n    &lt;\/Grid>\n&lt;\/Controls:MetroWindow>\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">ViewMainView.xaml.cs<\/h2>\n\n\n\n<pre class=\"wp-block-luxe-blocks-syntaxhighlighter line-numbers language-csharp\"><code class=\"language-csharp\">using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Documents;\nusing System.Windows.Input;\nusing System.Windows.Media;\nusing System.Windows.Media.Imaging;\nusing System.Windows.Shapes;\n\nnamespace SampleApp.View\n{\n    \/\/\/ &lt;summary>\n    \/\/\/ MainView.xaml \u306e\u76f8\u4e92\u4f5c\u7528\u30ed\u30b8\u30c3\u30af\n    \/\/\/ &lt;\/summary>\n    public partial class MainView : MahApps.Metro.Controls.MetroWindow\n    {\n        public MainView()\n        {\n            InitializeComponent();\n        }\n    }\n}\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">ViewModelMainViewModel.cs<\/h2>\n\n\n\n<pre class=\"wp-block-luxe-blocks-syntaxhighlighter line-numbers language-csharp\"><code class=\"language-csharp\">using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace SampleApp.ViewModel\n{\n    public class MainViewModel : Livet.ViewModel\n    {\n        public MahApps.Metro.Controls.Dialogs.IDialogCoordinator MahAppsDialogCoordinator { get; set; }\n\n        public void OnContentRendered()\n        {\n\n        }\n\n        public async void OnButtonClicked()\n        {\n            await MahAppsDialogCoordinator.ShowMessageAsync(this, \"ShowMessageBox\", \"ShowMessageBoxText\");\n        }\n    }\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,20,55,8],"tags":[35,24,29,27,23],"class_list":["post-520","post","type-post","status-publish","format-standard","hentry","category-c","category-wpf","category-55","category-8","tag-c","tag-livet","tag-mahapps","tag-material-design-in-xaml-toolkit","tag-wpf"],"_links":{"self":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/520","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=520"}],"version-history":[{"count":3,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/520\/revisions"}],"predecessor-version":[{"id":709,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/520\/revisions\/709"}],"wp:attachment":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=520"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=520"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=520"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}