{"id":343,"date":"2012-08-18T19:42:11","date_gmt":"2012-08-18T10:42:11","guid":{"rendered":"http:\/\/www.typea.info\/blog\/index.php\/2012\/08\/18\/silverlight_prism_mvvm_1\/"},"modified":"2012-08-18T19:42:11","modified_gmt":"2012-08-18T10:42:11","slug":"silverlight_prism_mvvm_1","status":"publish","type":"post","link":"https:\/\/www.typea.info\/blog\/index.php\/2012\/08\/18\/silverlight_prism_mvvm_1\/","title":{"rendered":"Silverlight Prism \u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u5229\u7528\u3057\u3066MVVM\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3057\u3066\u307f\u308b \u7b2c1\u56de"},"content":{"rendered":"<p>Prism\u306e\u60c5\u5831\u3082\u5c11\u306a\u3044\u306e\u3067\u3001\u958b\u767a\u30ac\u30a4\u30c9\u3082\u8cfc\u5165\u3057\u3066\u307f\u305f\u3002<\/p>\n<p> <iframe style=\"width: 120px; height: 240px\" marginheight=\"0\" src=\"http:\/\/rcm-jp.amazon.co.jp\/e\/cm?lt1=_blank&amp;bc1=FFFFFF&amp;IS2=1&amp;bg1=FFFFFF&amp;fc1=000000&amp;lc1=0000FF&amp;t=typea-pm-22&amp;o=9&amp;p=8&amp;l=as4&amp;m=amazon&amp;f=ifr&amp;ref=ss_til&amp;asins=073565610X\" frameborder=\"0\" marginwidth=\"0\" scrolling=\"no\"><\/iframe>  <\/p>\n<p>\u30fb\u30fb\u30fb\u30fb\u306e\u3060\u304c\u3001<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/gg406140\">MSDN\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u5185\u5bb9<\/a>\u3068\u540c\u4e00\u3060\u3063\u305f\u3002\u3046\u30fc\u30fc\u3093\u3002\u82e5\u5e72\u6050\u308c\u3066\u306f\u3044\u305f\u306e\u3060\u304c\u3001\u3061\u3087\u3063\u3068\u30bf\u30a4\u30c8\u30eb\u304c\u7570\u306a\u3063\u3066\u3044\u305f\u306e\u3067\u5225\u306e\u5185\u5bb9\u3067\u3042\u308b\u3053\u3068\u306b\u8ced\u3051\u305f\u306e\u3060\u304c\u3002<\/p>\n<p>\u3067\u3001\u3042\u307e\u308a\u6642\u9593\u304c\u306a\u3044\u306e\u3067\u3001QuickStart \u306e\u30b5\u30f3\u30d7\u30eb\u3092\u6982\u89b3<\/p>\n<ol>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2012\/08\/11\/prism_basic_mvvm_qukickstart\">MVVM QuickStart<\/a> <\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2012\/08\/13\/prism_silverlight_quickstarts\">\u30e2\u30b8\u30e5\u30fc\u30eb\u5316\u65b9\u6cd5 QuickStart<\/a> <\/li>\n<li><a href=\"https:\/\/www.typea.info\/blog\/index.php\/2012\/08\/17\/prism_ui_quickstart\">UI\u5408\u6210 QuickStart<\/a> <\/li>\n<\/ol>\n<p>\u3068\u3001\u4e3b\u3060\u3063\u3066\u3084\u308a\u305f\u3044\u3068\u3053\u308d\u306e\u30cb\u30e5\u30a2\u30f3\u30b9\u306f\u3064\u304b\u3081\u305f\u3002\u3002\u3002\u3088\u3046\u306a\u6c17\u304c\u3059\u308b\u306e\u3067\u3001<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ff921096(v=pandp.40).aspx\">Hands-On Lab<\/a> \u3092\u898b\u306a\u304c\u3089\u30011\u304b\u3089\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u3001Prism \u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3092\u9069\u7528\u3055\u305b\u3066\u3044\u304d\u305f\u3044\u3068\u601d\u3046\u3002<\/p>\n<h2><\/h2>\n<h2>\u984c\u6750\u30fb\u524d\u63d0<\/h2>\n<p>\u4ee5\u524d\u4f5c\u6210\u3057\u305f\u3001\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u958b\u767a\u898b\u7a4d\u306e\u305f\u3081\u306e\u3001<a href=\"http:\/\/typea-service.appspot.com\/fp\">\u30d5\u30a1\u30f3\u30af\u30b7\u30e7\u30f3\u30dd\u30a4\u30f3\u30c8\u8a08\u7b97\u30b5\u30a4\u30c8<\/a>\u306e\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3092Silverlight\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u3057\u3066\u3064\u304f\u308b\u3053\u3068\u3092\u984c\u6750\u3068\u3057\u3066\u9032\u3081\u3066\u3044\u304f\u3002<\/p>\n<p>DI\u30b3\u30f3\u30c6\u30ca\u306f\u3001MEF\u3092\u5229\u7528\u3059\u308b\u3002<\/p>\n<p>\u7b2c1\u56de\u306f\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u5206\u5272\u3068\u3001UI\u5408\u6210\u304c\u52d5\u304f\u3068\u3053\u308d\u307e\u3067\u3002<\/p>\n<h2>\u6e96\u5099<\/h2>\n<p>\u30bd\u30ea\u30e5\u30fc\u30b7\u30e7\u30f3\u306e\u30d5\u30a9\u30eb\u30c0\u306b\u3001Library.Silverlight \u30d5\u30a9\u30eb\u30c0\u3092\u4f5c\u6210\u3057\u3001\u4ee5\u4e0b\u306e\u30a2\u30bb\u30f3\u30d6\u30ea\u3092\u30b3\u30d4\u30fc\u3059\u308b\u3002<a href=\"https:\/\/www.typea.info\/blog\/index.php\/2012\/08\/05\/prism_visual_web_developer_2010_express\">\u30a2\u30bb\u30f3\u30d6\u30ea\u306f\u3001%Prism\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u30d5\u30a9\u30eb\u30c0%\\Bin\\Silverlight \u306b\u3042\u308b<\/a>\u3002<\/p>\n<ul>\n<li>Microsoft.Practices.Prism.dll <\/li>\n<li>Microsoft.Practices.Prism.MefExtensions.dll <\/li>\n<li>Microsoft.Practices.ServiceLocation.dll <\/li>\n<\/ul>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson01.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"prism_handson01\" border=\"0\" alt=\"prism_handson01\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson01_thumb.jpg\" width=\"278\" height=\"136\" \/><\/a> <\/p>\n<h2>Shell \u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/h2>\n<p>1.\u30bd\u30ea\u30e5\u30fc\u30b7\u30e7\u30f3\u30a8\u30af\u30b9\u30d7\u30ed\u30fc\u30e9\u30fc\u304b\u3089\u3001MainPage.xaml \u3092 Shell.xaml\u306b\u30ea\u30cd\u30fc\u30e0<\/p>\n<p>2.Shell.xaml.cs \u3092\u958b\u304d\u3001\u30b3\u30fc\u30c9\u30d3\u30cf\u30a4\u30f3\u30c9\u304b\u3089\u3001Shell\u306b\u540d\u524d\u5909\u66f4\u306e\u30ea\u30d5\u30a1\u30af\u30bf\u30ea\u30f3\u30b0<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson02.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"prism_handson02\" border=\"0\" alt=\"prism_handson02\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson02_thumb.jpg\" width=\"366\" height=\"108\" \/><\/a> <\/p>\n<p>3.Shell.xaml \u3092\u958b\u304d\u3001UserControll\u306e\u3001x:Class \u306e\u5024\u304c\u3001\u4e0a\u8a182\u306e\u30b3\u30fc\u30c9\u30d3\u30cf\u30a4\u30f3\u30c9\u306e\u30af\u30e9\u30b9\u3068\u4e00\u81f4\u3059\u308b\u3053\u3068\u3092\u78ba\u8a8d<\/p>\n<pre class=\"prettyprint linenums\">&lt;UserControl x:Class=&quot;PmToolsClient.Shell&quot;\r\n    xmlns=&quot;http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation&quot;\r\n    xmlns:x=&quot;http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml&quot;\r\n    xmlns:d=&quot;http:\/\/schemas.microsoft.com\/expression\/blend\/2008&quot;\r\n    xmlns:mc=&quot;http:\/\/schemas.openxmlformats.org\/markup-compatibility\/2006&quot;\r\n    mc:Ignorable=&quot;d&quot;\r\n    d:DesignHeight=&quot;300&quot; d:DesignWidth=&quot;400&quot;&gt;&lt;\/UserControl&gt;<\/pre>\n<p>4.Shell.xaml.cs \u306e Shell\u30af\u30e9\u30b9\u306b\u3001Export \u30a2\u30c8\u30ea\u30d3\u30e5\u30fc\u30c8\u3092\u4ed8\u4e0e\u3057\u30b3\u30f3\u30c6\u30ca\u306b\u767b\u9332\u3055\u305b\u308b<\/p>\n<p>\u578b\u3092\u767b\u9332\u3059\u308b\u5834\u5408\u3001<a href=\"http:\/\/d.hatena.ne.jp\/coma2n\/20090213\/1234510924\">Export(typeof(\u578b))\u3001\u540d\u524d\u3092\u767b\u9332\u3059\u308b\u5834\u5408\u3001Export(&quot;\u540d\u524d&quot;)<\/a> \u30d7\u30ed\u30d1\u30c6\u30a3\u3084\u30e1\u30bd\u30c3\u30c9\u3082\u5bfe\u8c61\u306b\u3067\u304d\u308b\u69d8\u3060\u3002 <\/p>\n<pre class=\"prettyprint linenums\">using System.ComponentModel.Composition;\r\nusing System.Windows.Controls;\r\n\r\nnamespace PmToolsClient\r\n{\r\n    [Export]\r\n    public partial class Shell : UserControl\r\n    {\r\n        public Shell()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n    }\r\n}<\/pre>\n<h2>Region<\/h2>\n<p>Shell.xaml \u306bRegion\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<ul>\n<li><a title=\"xmlns:prism=&quot;http:\/\/www.codeplex.com\/prism&quot; \" href=\"xmlns:prism=&quot;http:\/\/www.codeplex.com\/prism&quot; \">xmlns:prism=&quot;http:\/\/www.codeplex.com\/prism&quot; <\/a>\u3092\u8ffd\u8a18 <\/li>\n<li>xmlns:c=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls&quot;&#160; \u3092\u8ffd\u8a18 <\/li>\n<li>System.Windows.Controls \u3078\u306e\u53c2\u7167\u8a2d\u5b9a <\/li>\n<\/ul>\n<pre class=\"prettyprint linenums\">&lt;UserControl x:Class=&quot;PmToolsClient.Shell&quot;\r\n    xmlns=&quot;http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation&quot;\r\n    xmlns:x=&quot;http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml&quot;\r\n    xmlns:d=&quot;http:\/\/schemas.microsoft.com\/expression\/blend\/2008&quot;\r\n    xmlns:mc=&quot;http:\/\/schemas.openxmlformats.org\/markup-compatibility\/2006&quot;\r\n    xmlns:c=&quot;clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls&quot; \r\n    xmlns:prism=&quot;http:\/\/www.codeplex.com\/prism&quot; \r\n    mc:Ignorable=&quot;d&quot;\r\n    d:DesignHeight=&quot;300&quot; d:DesignWidth=&quot;400&quot;&gt;\r\n    \r\n    &lt;Grid x:Name=&quot;LayoutRoot&quot;&gt;\r\n        &lt;Border Grid.Row=&quot;1&quot;&gt;\r\n            &lt;ContentControl x:Name=&quot;LeftRegion&quot; prism:RegionManager.RegionName=&quot;LeftRegion&quot; HorizontalContentAlignment=&quot;Stretch&quot; \/&gt;\r\n        &lt;\/Border&gt;\r\n        &lt;Border Grid.Row=&quot;1&quot; Grid.Column=&quot;2&quot;&gt;\r\n            &lt;ContentControl x:Name=&quot;MainRegion&quot; prism:RegionManager.RegionName=&quot;MainRegion&quot; VerticalContentAlignment=&quot;Stretch&quot; HorizontalContentAlignment=&quot;Stretch&quot; \/&gt;\r\n        &lt;\/Border&gt;\r\n        &lt;c:GridSplitter Grid.Row=&quot;1&quot; Grid.Column=&quot;1&quot; HorizontalAlignment=&quot;Center&quot; VerticalAlignment=&quot;Stretch&quot; Background=&quot;{x:Null}&quot; Grid.RowSpan=&quot;2&quot; \/&gt;\r\n    &lt;\/Grid&gt;\r\n&lt;\/UserControl&gt;<\/pre>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson03.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"prism_handson03\" border=\"0\" alt=\"prism_handson03\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson03_thumb.jpg\" width=\"328\" height=\"198\" \/><\/a> <\/p>\n<h2>Bootstrapper<\/h2>\n<ul>\n<li>System.ComponentModel.Composition \u3092\u53c2\u7167\u8a2d\u5b9a\u306b\u8ffd\u52a0(<a href=\"http:\/\/msdn.microsoft.com\/ja-jp\/library\/dd823527(v=vs.95)\">System.ComponentModel.Composition.Hosting \u540d\u524d\u7a7a\u9593\u306b\u306f\u3001\u62e1\u5f35\u53ef\u80fd\u306a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u307e\u305f\u306f\u30db\u30b9\u30c8\u306e\u958b\u767a\u306b\u5f79\u7acb\u3064 MEF \u7528\u306e\u30af\u30e9\u30b9\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002)<\/a> <\/li>\n<\/ul>\n<ol>\n<li>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306bBootstrapper\u30af\u30e9\u30b9\u3092\u8ffd\u52a0 <\/li>\n<li>MefBootstrapper \u3092\u7d99\u627f\u3055\u305b\u308b <\/li>\n<li>CreateShell \u30e1\u30bd\u30c3\u30c9\u3092\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9 : Shell\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3059\u308b <\/li>\n<li>InitializeShell \u30e1\u30bd\u30c3\u30c9\u3092\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9 : Shell\u3092\u30e6\u30fc\u30b6\u30fc\u306b\u8868\u793a\u3059\u308b <\/li>\n<li>ConfigureAggregateCatalog \u30e1\u30bd\u30c3\u30c9\u3092\u30aa\u30fc\u30d0\u30fc\u30e9\u30a4\u30c9\u3057\u3001 this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Bootstrapper).Assembly)); \u3067\u3001\u81ea\u8eab\u306e\u30a2\u30bb\u30f3\u30d6\u30ea\u306eExport\u3092\u30b3\u30f3\u30c6\u30ca\u306b\u767b\u9332 <\/li>\n<li>App.xaml.cs \u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304d\u3001Application_Startup \u30a4\u30d9\u30f3\u30c8\u30cf\u30f3\u30c9\u30e9\u3092\u7f6e\u304d\u63db\u3048\u308b <\/li>\n<\/ol>\n<p><strong>Bootstrapper.cs<\/strong><\/p>\n<pre class=\"prettyprint linenums\">using System.ComponentModel.Composition.Hosting;\r\nusing System.Windows;\r\nusing Microsoft.Practices.Prism.MefExtensions;\r\n\r\nnamespace PmToolsClient\r\n{\r\n    public class Bootstrapper  : MefBootstrapper\r\n    {\r\n        protected override DependencyObject CreateShell()\r\n        {\r\n            return this.Container.GetExportedValue&lt;Shell&gt;();\r\n        }\r\n\r\n        protected override void InitializeShell()\r\n        {\r\n            base.InitializeShell();\r\n\r\n            Application.Current.RootVisual = (UIElement)this.Shell;\r\n        }\r\n\r\n        protected override void ConfigureAggregateCatalog()\r\n        {\r\n            base.ConfigureAggregateCatalog();\r\n\r\n            this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Bootstrapper).Assembly));\r\n        }\r\n\r\n    }\r\n}<\/pre>\n<p><strong>App.xaml.cs<\/strong> <\/p>\n<pre class=\"prettyprint linenums\">private void Application_Startup(object sender, StartupEventArgs e)\r\n{\r\n    \/\/ this.RootVisual = new Shell();\r\n    Bootstrapper bootstrapper = new Bootstrapper();\r\n    bootstrapper.Run();\r\n}<\/pre>\n<p>\u3053\u3053\u307e\u3067\u3067\u3001\u4e00\u65e6\u8d77\u52d5<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson04.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"prism_handson04\" border=\"0\" alt=\"prism_handson04\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson04_thumb.jpg\" width=\"298\" height=\"239\" \/><\/a> <\/p>\n<p>\u30d6\u30ec\u30fc\u30af\u30dd\u30a4\u30f3\u30c8\u3067\u3001CreateShell \u3067\u6b62\u3081\u3066\u3001Container\u306e\u4e2d\u3092\u306e\u305e\u304f\u3068\u3001Shell\u304c\u30ab\u30bf\u30ed\u30b0\u306b\u767b\u9332\u3055\u308c\u3066\u3044\u308b\u306e\u304c\u308f\u304b\u308b\u3002<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson05.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"prism_handson05\" border=\"0\" alt=\"prism_handson05\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson05_thumb.jpg\" width=\"388\" height=\"161\" \/><\/a> <\/p>\n<\/p>\n<h2>\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u8ffd\u52a0<\/h2>\n<h3>\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u4f5c\u6210<\/h3>\n<p>1.\u65b0\u898fSivlerlight \u30af\u30e9\u30b9\u30e9\u30a4\u30d6\u30e9\u30ea\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u8ffd\u52a0(\u30bd\u30ea\u30e5\u30fc\u30b7\u30e7\u30f3\u306e\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30e1\u30cb\u30e5\u30fc\u304b\u3089\u8ffd\u52a0\uff0d\u65b0\u3057\u3044\u30d7\u30ed\u30b8\u30a7\u30af\u30c8)<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson06.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"prism_handson06\" border=\"0\" alt=\"prism_handson06\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson06_thumb.jpg\" width=\"368\" height=\"177\" \/><\/a> <\/p>\n<p>2.\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u3001Microsoft.Practices.Prism.dll \u3001Microsoft.Practices.Prism.MefExtensions.dll \u3001System.ComponentModel.Composition \u3078\u306e\u53c2\u7167\u3092\u8ffd\u52a0<\/p>\n<p>3.\u81ea\u52d5\u751f\u6210\u3055\u308c\u305f\u3001Class1.cs \u306e Class1 \u3092 \u30ea\u30d5\u30a1\u30af\u30bf\u30ea\u30f3\u30b0\u3092\u4f7f\u3063\u3066\u30ea\u30cd\u30fc\u30e0(ModlueInit)\u3002\u30d5\u30a1\u30a4\u30eb\u540d\u3082\u5909\u66f4\u3059\u308b(ModlueInit.cs)<\/p>\n<p>4.using Microsoft.Practices.Prism.Modularity; \u3092\u8ffd\u8a18<\/p>\n<p>5.IModule \u3092\u5b9f\u88c5\u3055\u305b\u308b<\/p>\n<p>6.ModuleExport \u30a2\u30c8\u30ea\u30d3\u30e5\u30fc\u30c8\u3092\u8ffd\u52a0<\/p>\n<p>7.Initialize() \u30e1\u30bd\u30c3\u30c9\u3092\u5b9f\u88c5<\/p>\n<pre class=\"prettyprint linenums\">using Microsoft.Practices.Prism.MefExtensions.Modularity;\r\nusing Microsoft.Practices.Prism.Modularity;\r\n\r\nnamespace ProjectModule\r\n{\r\n    [ModuleExport(typeof(ModlueInit))]\r\n    public class ModlueInit : IModule\r\n    {\r\n        public void Initialize()\r\n        {\r\n        }\r\n    }\r\n}<\/pre>\n<p>8.Controllers\u3001Services\u3001Views \u30d5\u30a9\u30eb\u30c0\u3092\u8ffd\u52a0<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson07.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"prism_handson07\" border=\"0\" alt=\"prism_handson07\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson07_thumb.jpg\" width=\"227\" height=\"244\" \/><\/a><\/p>\n<p>9.\u4e00\u65e6\u30d3\u30eb\u30c9<\/p>\n<h2>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u306b\u304a\u3044\u3066\u306e\u30e2\u30b8\u30e5\u30fc\u30eb<\/h2>\n<p>\u30e2\u30b8\u30e5\u30fc\u30eb\u306f\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30e9\u30a4\u30d5\u30b5\u30a4\u30af\u30eb\u306b\u304a\u3044\u3066\u3001\u4ee5\u4e0b\u306e3\u3064\u306e\u30b9\u30c6\u30c3\u30d7\u3092\u7d4c\u308b<\/p>\n<ol>\n<li>\u30e2\u30b8\u30e5\u30fc\u30eb\u306f\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u30ab\u30bf\u30ed\u30b0\u306b\u3088\u308a\u3001\u767a\u898b\u3055\u308c\u308b\u3002\u30e2\u30b8\u30e5\u30fc\u30eb\u30ab\u30bf\u30ed\u30b0\u306f\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u30e1\u30bf\u30c7\u30fc\u30bf\u306b\u3064\u3044\u3066\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u3002\u30e1\u30bf\u30c7\u30fc\u30bf\u306f\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u30b5\u30fc\u30d3\u30b9\u306b\u3088\u3063\u3066\u5229\u7528\u3055\u308c\u308b <\/li>\n<li>\u30e2\u30b8\u30e5\u30fc\u30eb\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u30b5\u30fc\u30d3\u30b9\u306f\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u53c2\u7167\u3068\u3001\u7d9a\u3044\u3066\u8d77\u3053\u308b\u521d\u671f\u5316\u3092\u8abf\u6574\u3059\u308b\u3002 <\/li>\n<li>\u6700\u5f8c\u306b\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u306f\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u521d\u671f\u5316\u30af\u30e9\u30b9\u306eInitialize \u30e1\u30bd\u30c3\u30c9\u3092\u547c\u3073\u51fa\u3059\u3002 <\/li>\n<\/ol>\n<h3><\/h3>\n<h3>\u30e2\u30b8\u30e5\u30fc\u30eb\u30ab\u30bf\u30ed\u30b0\u306e\u4f5c\u6210<\/h3>\n<p>Silverlight\u3067\u306f\u3001\u30b3\u30fc\u30c9\u3082\u3057\u304f\u306f\u3001XAML\u3092\u5229\u7528\u3057\u3066\u30e2\u30b8\u30e5\u30fc\u30eb\u30ab\u30bf\u30ed\u30b0\u3092\u4f5c\u6210\u3067\u304d\u308b<\/p>\n<h4>\u30b3\u30fc\u30c9\u304b\u3089\u30ab\u30bf\u30ed\u30b0\u3092\u4f5c\u6210<\/h4>\n<p>1.Shell\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u3001\u30e2\u30b8\u30e5\u30fc\u30eb\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u53c2\u7167\u3092\u8ffd\u52a0\u3059\u308b<\/p>\n<p>2.Bootstrapper.cs \u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304d\u3001ConfigureAggregateCatalog \u30e1\u30bd\u30c3\u30c9\u306b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u5b9f\u88c5\u3059\u308b<\/p>\n<pre class=\"prettyprint linenums\">protected override void ConfigureAggregateCatalog()\r\n{\r\n    base.ConfigureAggregateCatalog();\r\n\r\n    this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(Bootstrapper).Assembly));\r\n    this.AggregateCatalog.Catalogs.Add(new AssemblyCatalog(typeof(ProjectModule.ProjectModule).Assembly));\r\n}<\/pre>\n<p>3.\u30d3\u30eb\u30c9\u3057\u3066\u5b9f\u884c<\/p>\n<p>\u30d6\u30ec\u30fc\u30af\u30dd\u30a4\u30f3\u30c8\u8a2d\u5b9a\u3067\u3001\u30ab\u30bf\u30ed\u30b0\u306b\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u8ffd\u52a0\u3055\u308c\u305f\u306e\u304c\u78ba\u8a8d\u3067\u304d\u308b<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson08.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"prism_handson08\" border=\"0\" alt=\"prism_handson08\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson08_thumb.jpg\" width=\"358\" height=\"153\" \/><\/a> <\/p>\n<h2>View \u306e\u8ffd\u52a0<\/h2>\n<h3>View\u306e\u4f5c\u6210<\/h3>\n<p>1.\u30e2\u30b8\u30e5\u30fc\u30eb\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u3001Views\u30d5\u30a9\u30eb\u30c0\u306e\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30e1\u30cb\u30e5\u30fc\u304b\u3089\u3001\u8ffd\u52a0 \uff0d \u65b0\u3057\u3044\u9805\u76ee\u3092\u9078\u3073\u3001Silverlight\u30e6\u30fc\u30b6\u30fc\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u3092\u8ffd\u52a0\u3059\u308b<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson09.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"prism_handson09\" border=\"0\" alt=\"prism_handson09\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson09_thumb.jpg\" width=\"325\" height=\"199\" \/><\/a> <\/p>\n<p>2.\u4e00\u65e6\u3001\u4ee5\u4e0b\u306e\u5185\u5bb9\u3068\u3057\u3066\u304a\u304f\u3002(<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/gg405484(v=pandp.40).aspx\">MVVM\u30d1\u30bf\u30fc\u30f3\u306b\u306f\u8ffd\u3063\u3066\u5bfe\u5fdc<\/a>)<\/p>\n<p>3.\u30b3\u30fc\u30c9\u30d3\u30cf\u30a4\u30f3\u30c9\u304b\u3089\u30af\u30e9\u30b9\u3092Export<\/p>\n<pre class=\"prettyprint linenums\">using System.ComponentModel.Composition;\r\nusing System.Windows.Controls;\r\n\r\nnamespace ProjectModule.Views\r\n{\r\n    [Export(typeof(ProjectList))]\r\n    public partial class ProjectList : UserControl\r\n    {\r\n        public ProjectList()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n    }\r\n}<\/pre>\n<pre class=\"prettyprint linenums\">&lt;UserControl x:Class=&quot;ProjectModule.Views.ProjectList&quot;\r\n             xmlns=&quot;http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml\/presentation&quot;\r\n             xmlns:x=&quot;http:\/\/schemas.microsoft.com\/winfx\/2006\/xaml&quot;\r\n             xmlns:prism=&quot;http:\/\/www.codeplex.com\/prism&quot;&gt;\r\n    &lt;Grid x:Name=&quot;LayoutRoot&quot; Background=&quot;White&quot;&gt;\r\n        &lt;TextBlock Text=&quot;Hello Prism World&quot; Foreground=&quot;Green&quot; FontFamily=&quot;Calibri&quot; FontSize=&quot;24&quot; FontWeight=&quot;Bold&quot;&gt;&lt;\/TextBlock&gt;\r\n    &lt;\/Grid&gt;\r\n&lt;\/UserControl&gt;<\/pre>\n<h2><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson10.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"prism_handson10\" border=\"0\" alt=\"prism_handson10\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson10_thumb.jpg\" width=\"340\" height=\"161\" \/><\/a> <\/h2>\n<h2>RegionManager<\/h2>\n<p>RegionManager \u30b5\u30fc\u30d3\u30b9\u306f\u3001Region\u306e\u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u306e\u7dad\u6301\u3068\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb\u7528\u306e\u65b0\u3057\u3044Region\u306e\u751f\u6210\u306b\u8cac\u4efb\u3092\u6301\u3064\u3002\u3053\u306e\u30b5\u30fc\u30d3\u30b9\u306f\u3001<strong>Microsoft.Practices.Prism.Regions.IRegionManager <\/strong>\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u5b9f\u88c5\u3057\u3066\u3044\u308b\u3002<\/p>\n<h3>Shell\u306bView\u3092\u8868\u793a\u3059\u308b<\/h3>\n<p>ModuleInit \u30af\u30e9\u30b9\u306b\u4ee5\u4e0b\u306e\u5909\u66f4\u3092\u884c\u3046<\/p>\n<ol>\n<li>using Microsoft.Practices.Prism.Regions; \u5ba3\u8a00\u3092\u8ffd\u52a0 <\/li>\n<li>\u8aad\u307f\u53d6\u308a\u5c02\u7528\u30e1\u30f3\u30d0\u30fc\u3092\u8ffd\u52a0 private readonly IRegionManager regionManager; <\/li>\n<li>ModuleInit \u30af\u30e9\u30b9\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u3092\u8a18\u8ff0\u3002\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u30a4\u30f3\u30b8\u30a7\u30af\u30b7\u30e7\u30f3\u3067\u3001IReagionManager\u3092\u8a2d\u5b9a\u3059\u308b <\/li>\n<li>ModuleInit \u30af\u30e9\u30b9\u306e Initialize \u30e1\u30bd\u30c3\u30c9\u3092\u5b9f\u88c5\u3057\u3001<strong>RegisterViewWithRegion<\/strong> \u3067\u3001Region\u3068View\u3092\u7d50\u3073\u3064\u3051\u308b <\/li>\n<\/ol>\n<pre class=\"prettyprint linenums\">using Microsoft.Practices.Prism.MefExtensions.Modularity;\r\nusing Microsoft.Practices.Prism.Modularity;\r\nusing Microsoft.Practices.Prism.Regions;\r\nusing System.ComponentModel.Composition;\r\n\r\nnamespace ProjectModule\r\n{\r\n    [ModuleExport(typeof(ModlueInit))]\r\n    public class ModlueInit : IModule\r\n    {\r\n        private IRegionManager regionManager;\r\n\r\n        [ImportingConstructor]\r\n        public ModlueInit(IRegionManager regionManager)\r\n        {\r\n            this.regionManager = regionManager;\r\n        } \r\n\r\n        public void Initialize()\r\n        {\r\n            this.regionManager.RegisterViewWithRegion(&quot;LeftRegion&quot;, typeof(Views.ProjectList));\r\n        }\r\n    }\r\n}<\/pre>\n<p>\u5b9f\u884c<\/p>\n<p><a href=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson11.jpg\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"prism_handson11\" border=\"0\" alt=\"prism_handson11\" src=\"https:\/\/www.typea.info\/blog\/wp-content\/uploads\/image\/Prism_AAF3\/prism_handson11_thumb.jpg\" width=\"340\" height=\"273\" \/><\/a><\/p>\n<p>\u3068\u308a\u3042\u3048\u305a\u3001\u3053\u3053\u307e\u3067\u306f\u306a\u3093\u3068\u304bOK\u3002<\/p>\n<p><iframe style=\"width: 120px; height: 240px\" marginheight=\"0\" src=\"http:\/\/rcm-jp.amazon.co.jp\/e\/cm?lt1=_blank&amp;bc1=FFFFFF&amp;IS2=1&amp;bg1=FFFFFF&amp;fc1=000000&amp;lc1=0000FF&amp;t=typea-pm-22&amp;o=9&amp;p=8&amp;l=as4&amp;m=amazon&amp;f=ifr&amp;ref=ss_til&amp;asins=4797363584\" frameborder=\"0\" marginwidth=\"0\" scrolling=\"no\"><\/iframe><iframe style=\"width: 120px; height: 240px\" marginheight=\"0\" src=\"http:\/\/rcm-jp.amazon.co.jp\/e\/cm?lt1=_blank&amp;bc1=FFFFFF&amp;IS2=1&amp;bg1=FFFFFF&amp;fc1=000000&amp;lc1=0000FF&amp;t=typea-pm-22&amp;o=9&amp;p=8&amp;l=as4&amp;m=amazon&amp;f=ifr&amp;ref=ss_til&amp;asins=4797363274\" frameborder=\"0\" marginwidth=\"0\" scrolling=\"no\"><\/iframe><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prism\u306e\u60c5\u5831\u3082\u5c11\u306a\u3044\u306e\u3067\u3001\u958b\u767a\u30ac\u30a4\u30c9\u3082\u8cfc\u5165\u3057\u3066\u307f\u305f\u3002 \u30fb\u30fb\u30fb\u30fb\u306e\u3060\u304c\u3001MSDN\u3067\u516c\u958b\u3055\u308c\u3066\u3044\u308b\u5185\u5bb9\u3068\u540c\u4e00\u3060\u3063\u305f\u3002\u3046\u30fc\u30fc\u3093\u3002\u82e5\u5e72\u6050\u308c\u3066\u306f\u3044\u305f\u306e\u3060\u304c\u3001\u3061\u3087\u3063\u3068\u30bf\u30a4\u30c8\u30eb\u304c\u7570\u306a\u3063\u3066\u3044\u305f\u306e\u3067\u5225\u306e\u5185\u5bb9\u3067\u3042\u308b\u3053\u3068\u306b\u8ced\u3051\u305f\u306e\u3060\u304c\u3002  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sns_share_botton_hide":"","vkExUnit_sns_title":"","_vk_print_noindex":"","sitemap_hide":"","_veu_custom_css":"","veu_display_promotion_alert":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[55,54],"tags":[],"class_list":["post-343","post","type-post","status-publish","format-standard","hentry","category-prism","category-silverlight"],"veu_head_title_object":{"title":"","add_site_title":""},"_links":{"self":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/343","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=343"}],"version-history":[{"count":0,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/posts\/343\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.typea.info\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}