{"id":5370,"date":"2014-02-02T01:40:32","date_gmt":"2014-02-01T07:40:32","guid":{"rendered":"http:\/\/www.moonmile.net\/blog\/?p=5370"},"modified":"2014-02-02T01:41:53","modified_gmt":"2014-02-01T16:41:53","slug":"cakephp%e3%81%aexml%e3%83%ac%e3%82%b9%e3%83%9d%e3%83%b3%e3%82%b9%e3%82%92wpf%e3%81%a7%e4%b8%80%e8%a6%a7%e8%a1%a8%e7%a4%ba%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"http:\/\/www.moonmile.net\/blog\/archives\/5370","title":{"rendered":"CakePHP\u306eXML\u30ec\u30b9\u30dd\u30f3\u30b9\u3092WPF\u3067\u4e00\u89a7\u8868\u793a\u3059\u308b"},"content":{"rendered":"<p>\n\u4f59\u88d5\u304c\u3042\u308b\u3046\u3061\u306bCakePHP\u3068WPF\u306e\u76f8\u4e92\u904b\u7528\u3092\u307e\u3068\u3081\u3066\u3044\u304f\uff08\u6e96\u5099\u7de8\uff09 | Moonmile Solutions Blog<br \/>\n<a href=\"http:\/\/www.moonmile.net\/blog\/archives\/5329\">http:\/\/www.moonmile.net\/blog\/archives\/5329<\/a>\n<\/p>\n<p>\n\u306e\u7d9a\u304d\u3067\u3001\u4eca\u5ea6\u306fWPF\u5074\u304b\u3089\u306e\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u3067\u3059\u3002<br \/>\n\u3044\u308f\u3086\u308b\u3001\u4ee5\u4e0b\u306a\u611f\u3058\u306a\u3001\u30ea\u30b9\u30c8\u30d3\u30e5\u30fc\u3068\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u8868\u793a\u3059\u308b\u30de\u30b9\u30bf\u30fc\u753b\u9762\u3092\u60f3\u5b9a\u3057\u307e\u3059\u3002\n<\/p>\n<p><a href='http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2014\/02\/wpid-dworkblogimage20140202_01org.jpg'><img border='0' src='http:\/\/www.moonmile.net\/blog\/wp-content\/uploads\/2014\/02\/wpid-dworkblogimage20140202_01thum.jpg'\/><\/a><\/p>\n<p>\n\u4e00\u89a7\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3068\u3001Web API\u306b\u3064\u306a\u3052\u3066\u4e00\u89a7\u3092\u53d6\u5f97\u3002\u30ea\u30b9\u30c8\u30d3\u30e5\u30fc\u306e\u5404\u884c\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u53f3\u5074\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u8a73\u7d30\u306a\u5024\u304c\u307d\u3061\u307d\u3061\u3068\u8868\u793a\u3055\u308c\u308b\u30d1\u30bf\u30fc\u30f3\u3067\u3059\u3002\u3053\u306e\u3042\u305f\u308a\u3001WPF\u306a\u306e\u3067\u3001\u9069\u5f53\u306b Binding \u3092\u4f7f\u3044\u307e\u3059\u3002\u6700\u7d42\u7684\u306b\u306f\u3001Visual Studio \u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u3088\u3046\u306b\u81ea\u52d5\u5316\u3092\u76ee\u6307\u3057\u305f\u3044\u3068\u3053\u308d\u306a\u306e\u3067\u3059\u304c&#8230;\u307e\u3042\u3001\u696d\u52d9\u7684\u306b\u306f\u5404\u7a2e\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u30a6\u30a3\u30f3\u30c9\u30a6\u3092\u3061\u307e\u3061\u307e\u4f5c\u3063\u3066\u3044\u307e\u3059\u3002\u3068\u3044\u3046\u306e\u3082\u3001\u5b8c\u5168\u306b\u81ea\u52d5\u5316\u3057\u3066\u3057\u307e\u3046\u3068\u4f7f\u3044\u52dd\u624b\u304c\u60aa\u3044\u3053\u3068\u304c\u3042\u308b\uff08\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u69cb\u9020\u306b\u5f15\u304d\u305a\u3089\u308c\u308b\uff09\u3053\u3068\u306b\u306a\u308b\u306e\u3067\u3001\u3053\u306e\u3042\u305f\u308a\u306f\u9069\u5b9c\u30ab\u30b9\u30bf\u30e0\u3067\u3002<br \/>\n\u3068\u306f\u3044\u3048\u3001cake bake \u3067\u81ea\u52d5\u5316\u3067\u304d\u308b\u3050\u3089\u3044\u306b\u306f\u3001\u53d7\u3051\u5074\u306e WPF \u306e\u30de\u30b9\u30bf\u30fc\u753b\u9762\u3082\u81ea\u52d5\u5316\u751f\u6210\u3057\u3066\u304a\u304d\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u3002\n<\/p>\n<p>\n\u25a0\u30c7\u30fc\u30bf\u30e2\u30c7\u30eb\u3092\u4f5c\u308b\n<\/p>\n<p>\n\u307e\u305a\u306f\u3001Model \u3092\u4f5c\u308a\u307e\u3059\u3002\u304a\u5e97\uff08Store\uff09\u30af\u30e9\u30b9\u306f\u3001\u4f1a\u793e\uff08Sellingcompany\uff09\u3068\u5730\u57df\uff08Areagroup\uff09\u304c\u7d10\u3065\u3044\u3066\u3044\u308b\u306e\u3067\u3001Store\u30af\u30e9\u30b9\u306e\u4e2d\u306b\u30d7\u30ed\u30d1\u30c6\u30a3\u3068\u3057\u3066\u5165\u308c\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u3053\u306e\u3042\u305f\u308a\u306e\u69cb\u9020\u306f\u3001CakePHP\u304c\u8fd4\u3059XML\u304c\u30d5\u30e9\u30c3\u30c8\u306a\u69cb\u9020\uff08Store, Sellingcompany, Areagroup\u304c\u4e26\u5217\u3067\u5b58\u5728\uff09\u306b\u5bfe\u3057\u3066\u3001\u30e2\u30c7\u30eb\u306e\u307b\u3046\u306f\u30c4\u30ea\u30fc\u69cb\u9020\u306b\u306a\u308a\u307e\u3059\u3002IModel.FormXml \u30e1\u30bd\u30c3\u30c9\u306f\u3001XElement \u304b\u3089\u9069\u5f53\u306b\u30e2\u30c7\u30eb\u306b\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u5165\u308c\u8fbc\u3080\u305f\u3081\u306e\u7c21\u6613\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002\u696d\u52d9\u306e\u307b\u3046\u306f ExDoc \u3092\u4f7f\u3063\u3066\u307f\u307e\u3057\u305f\u304c\u3001\u8a66\u3057\u306b XElement.Descendants \u3092\u4f7f\u3063\u3066\u30d1\u30fc\u30b9\u3002\n<\/p>\n<ul>\n<li>Web API\u304c\u8fd4\u3059\u8981\u7d20\u540d<\/li>\n<li>\u53d7\u3051\u53d6\u308b\u3068\u304d\u306e\u30af\u30e9\u30b9\u540d<\/li>\n<li>\u53d7\u3051\u53d6\u308b\u3068\u304d\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u540d<\/li>\n<\/ul>\n<p>\n\u3092\u5927\u6587\u5b57\u5c0f\u6587\u5b57\u3082\u5408\u308f\u305b\u3066\u5b8c\u5168\u306b\u4e00\u81f4\u3055\u305b\u3066\u304a\u304f\u3068\u3001\u3053\u306e\u65b9\u6cd5\u304c\u53d6\u308c\u307e\u3059\u3002\u9006\u306b\u8a00\u3048\u3070\u3001\u305d\u308c\u305e\u308c\u306e\u540d\u524d\u304c\u5fae\u5999\u306b\u9055\u3063\u305f\u30ea\u30b9\u30c8\u9762\u5012\u306a\u3053\u3068\u306b\u306a\u308b\u308f\u3051\u3067\u3059\u304c&#8230;\u307e\u3042\u3001\u305d\u306e\u3068\u304d\u306f\u5c5e\u6027\u3092\u4f7f\u3063\u3066\u56de\u907f\u3059\u308b\u306e\u3082\u3088\u3057\u3001\u3053\u3053\u306e FromXml\u3067\u66f8\u304d\u63db\u3048\u308b\u3082\u3088\u3057\u3001\u3068\u3044\u3046\u3068\u3053\u308d\u3067\u3059\u3002\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\npublic class IModel\r\n{\r\n    public void FormXml(XElement el)\r\n    {\r\n        var pis = this.GetType().GetProperties();\r\n        foreach (var pi in pis)\r\n        {\r\n            var vv = el.Descendants(pi.Name).FirstOrDefault();\r\n            if (vv != null)\r\n            {\r\n                var v = vv.Value;\r\n                if (pi.PropertyType == typeof(int))\r\n                    pi.SetValue(this, int.Parse(v));\r\n                else if (pi.PropertyType == typeof(double))\r\n                    pi.SetValue(this, double.Parse(v));\r\n                else if (pi.PropertyType == typeof(string))\r\n                    pi.SetValue(this, v);\r\n            }\r\n        }\r\n    }\r\n}\r\n\r\npublic class Store : IModel\r\n{\r\n    public int ID { get; set; }\r\n    public int SellingCompanyID { get; set; }\r\n    public int AreaGroupID { get; set; }\r\n    public string Code { get; set; }\r\n    public string Name { get; set; }\r\n    public string Person { get; set; }\r\n    public string Tel { get; set; }\r\n    public string EMail { get; set; }\r\n    public string ApplicationProgress { get; set; }\r\n    public int Enabled { get; set; }\r\n    public DateTime modified { get; set; }\r\n    public DateTime created { get; set; }\r\n    \/\/ \u30ea\u30f3\u30af\u5148\r\n    public Areagroup Areagroup { get; set; }\r\n    public Sellingcompany Sellingcompany { get; set; }\r\n\r\n    public Store(XElement el)\r\n    {\r\n        base.FormXml(el);\r\n        this.Areagroup = new Areagroup(el.Parent.Descendants(&quot;Areagroup&quot;).FirstOrDefault());\r\n        this.Sellingcompany = new Sellingcompany(el.Parent.Descendants(&quot;Sellingcompany&quot;).FirstOrDefault());\r\n    }\r\n}\r\npublic class Areagroup : IModel\r\n{\r\n    public int ID { get; set; }\r\n    public string Name { get; set; }\r\n    public string DisplayName { get; set; }\r\n    public int SortKey { get; set; }\r\n    public int ColorR { get; set; }\r\n    public int ColorG { get; set; }\r\n    public int ColorB { get; set; }\r\n    public int ForeColorBW { get; set; }\r\n    public int ExcelColor { get; set; }\r\n    public int Enabled { get; set; }\r\n    public DateTime modified { get; set; }\r\n    public DateTime created { get; set; }\r\n\r\n    public Areagroup(XElement el) { base.FormXml(el); }\r\n}\r\n\r\npublic class Sellingcompany : IModel\r\n{\r\n    public int ID { get; set; }\r\n    public int ManufacturerID { get; set; }\r\n    public int JurisdictionID { get; set; }\r\n    public string Name { get; set; }\r\n    public string Abbreviation { get; set; }\r\n    public string Code { get; set; }\r\n    public int Enabled { get; set; }\r\n    public DateTime modified { get; set; }\r\n    public DateTime created { get; set; }\r\n\r\n    public Sellingcompany(XElement el) { base.FormXml(el); }\r\n}\r\n<\/pre>\n<p>\n\u305d\u308c\u305e\u308c\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306f\u3061\u307e\u3061\u307e\u3068\u66f8\u3044\u3066\u3082\u3044\u3044\u306e\u3067\u3059\u304c\u3001Visual Studio 2013 \u3060\u3068\u300c\u7de8\u96c6\u300d\u30e1\u30cb\u30e5\u30fc\u306e\u300c\u578b\u5f0f\u3092\u9078\u629e\u3057\u3066\u8cbc\u308a\u4ed8\u3051\u300d\u2192\u300cXML\u3092\u30af\u30e9\u30b9\u3068\u3057\u3066\u8cbc\u308a\u4ed8\u3051\u308b\u300d\u3092\u9078\u3076\u3068\u7c21\u5358\u306b\u4f5c\u308c\u307e\u3059&#8230;\u304c\u3001JSON\u306e\u3068\u304d\u3068XML\u306e\u6642\u3068\u9055\u3046\u51fa\u529b\u306b\u306a\u308b\u306e\u3067\u3001\u306a\u3093\u3060\u304b\u306a\uff5e\u3068\u3044\u3046\u611f\u3058\u306a\u306e\u3068\u3001MVVM \u306e Model \u306b\u3059\u308b\u3068\u304d\u306f\u3061\u307e\u3061\u307e\u3068\u624b\u4f5c\u696d\u3067\u5909\u3048\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093\u3002\u307e\u3042\u3001\u305d\u306e\u6642\u306f\u9069\u5f53\u306a\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u3051\u3070\u6e08\u3080\u308f\u3051\u3067\u3059\u304c\u3002<br \/>\nStore \u30af\u30e9\u30b9\u306e\u30b3\u30f3\u30b9\u30c8\u30e9\u30af\u30bf\u304c\u3084\u3084\u3053\u3057\u3044\u3053\u3068\u306b\u306a\u3063\u3066\u3044\u308b\u306e\u306f\u3001Web API\u304c\u8fd4\u3059XML\u69cb\u9020\u3068Model.Store\u30af\u30e9\u30b9\u306e\u30c4\u30ea\u30fc\u69cb\u9020\u304c\u7570\u306a\u308b\u304b\u3089\u3067\u3059\u3002\u3053\u3053\u3092\u540c\u3058\u306b\u3057\u3066\u3082\u3088\u3044\u306e\u3067\u3059\u304c\u3001CakePHP\u306e\u51fa\u529b\u3068WPF\u3067\u30d0\u30a4\u30f3\u30c9\u3092\u3059\u308b\u3068\u304d\u306e\u4fbf\u5229\u3055\u3068\u304c\u7570\u306a\u308b\u306e\u3001\u3053\u3053\u3067\u8abf\u7bc0\u3057\u3066\u304a\u304f\u307b\u3046\u304c\u30d9\u30bf\u30fc\u3067\u3059\u3002\n<\/p>\n<p>\n\u25a0\u30ea\u30b9\u30c8\u30d3\u30e5\u30fc\u3092\u4f5c\u308b\n<\/p>\n<p>\n\u5de6\u5074\u306e\u30ea\u30b9\u30c8\u30d3\u30e5\u30fc\u3092\u4f5c\u308a\u307e\u3059\u3002DataContext\u3092\u4f7f\u3063\u305f\u30c7\u30fc\u30bf\u30d0\u30a4\u30f3\u30c9\u304c\u524d\u63d0\u306b\u306a\u308b\u306e\u3067\u3001\u3061\u307e\u3061\u307e\u3068\u30d0\u30a4\u30f3\u30c9\u5f0f\u3092\u66f8\u3044\u3066\u304d\u307e\u3059\u3002\n<\/p>\n<p>\n\u6700\u4f4e\u9650\u30d0\u30a4\u30f3\u30c9\u3057\u3066\u304a\u304f\u7b87\u6240\u306f\u3001\n<\/p>\n<ul>\n<li>ListView \u306b ItemsSource=&#8221;{Binding Items}&#8221; \u3067\u30d0\u30a4\u30f3\u30c9<\/li>\n<li>\u305d\u308c\u305e\u308c\u306e\u5217\u306b DisplayMemberBinding=&#8221;{Binding ID}&#8221; \u3067\u30d0\u30a4\u30f3\u30c9<\/li>\n<\/ul>\n<p>\n\u30d3\u30e5\u30fc\u306b\u30d0\u30a4\u30f3\u30c9\u3059\u308b\u30e2\u30c7\u30eb\u304b\u3089 Items \u30d7\u30ed\u30d1\u30c6\u30a3\u3067 bind \u3055\u305b\u307e\u3059\u3002\u305d\u3057\u3066\u3001\u305d\u308c\u305e\u308c\u306e\u30a2\u30a4\u30c6\u30e0\uff08\u8981\u7d20\uff09\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u30d0\u30a4\u30f3\u30c9\u3055\u305b\u308b\u308f\u3051\u3067\u3059\u304c\u3001DisplayMemberBinding=&#8221;{Binding Sellingcompany.Name}&#8221; \u306e\u3088\u3046\u306b\u3001\u5185\u90e8\u3082\u3064\u30af\u30e9\u30b9\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u53c2\u7167\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u30c4\u30ea\u30fc\u69cb\u9020\u306b\u3057\u3066\u304a\u304f\u3068\u3001\u89aa\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30ea\u30b9\u30c8\u5316\u3057\u3066\u304a\u3044\u3066\u3001\u305d\u308c\u305e\u308c\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u30a2\u30af\u30bb\u30b9\u304c\u3067\u304d\u307e\u3059\u3002\n<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;ListView \r\n    x:Name=&amp;quot;lv&amp;quot;\r\n    ItemsSource=&amp;quot;{Binding Items}&amp;quot;\r\n    SelectionChanged=&amp;quot;lv_SelectionChanged&amp;quot;\r\n    HorizontalAlignment=&amp;quot;Left&amp;quot; Height=&amp;quot;235&amp;quot; Margin=&amp;quot;10,10,0,0&amp;quot; Grid.Row=&amp;quot;1&amp;quot; VerticalAlignment=&amp;quot;Top&amp;quot; Width=&amp;quot;315&amp;quot;&gt;\r\n    &lt;ListView.View&gt;\r\n        &lt;GridView&gt;\r\n            &lt;GridViewColumn Header=&amp;quot;ID&amp;quot; \r\n                            DisplayMemberBinding=&amp;quot;{Binding ID}&amp;quot; Width=&amp;quot;50&amp;quot;\/&gt;\r\n            &lt;GridViewColumn Header=&amp;quot;\u540d\u524d&amp;quot; \r\n                            DisplayMemberBinding=&amp;quot;{Binding Name}&amp;quot; Width=&amp;quot;50&amp;quot;\/&gt;\r\n            &lt;GridViewColumn Header=&amp;quot;\u4f1a\u793e\u540d&amp;quot; \r\n                            DisplayMemberBinding=&amp;quot;{Binding Sellingcompany.Name}&amp;quot; Width=&amp;quot;50&amp;quot;\/&gt;\r\n            &lt;GridViewColumn Header=&amp;quot;\u5730\u57df&amp;quot; \r\n                            DisplayMemberBinding=&amp;quot;{Binding Areagroup.Name}&amp;quot; Width=&amp;quot;50&amp;quot;\/&gt;\r\n        &lt;\/GridView&gt;\r\n    &lt;\/ListView.View&gt;\r\n&lt;\/ListView&gt;\r\n<\/pre>\n<p>\n\u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u5165\u308c\u5b50\u306b\u306a\u3063\u3066\u30d0\u30a4\u30f3\u30c9\u304c\u3067\u304d\u308b\u306e\u306f\u4fbf\u5229\u306a\u306e\u3067\u3059\u304c\u3001\u9006\u306b\u8a00\u3048\u3070\u30d7\u30ed\u30d1\u30c6\u30a3\u540d\u304c\u5909\u308f\u3063\u305f\u3068\u304d\u306b\u306f\u3001XAML \u90e8\u5206\u3082\u76f4\u3055\u306a\u3044\u3068\u3044\u3051\u306a\u3044\u3068\u3044\u3046\u5f0a\u5bb3\u3082\u3042\u308a\u307e\u3059\u3002\u305d\u306e\u3042\u305f\u308a\u306f\u5148\u306e Web API \u3068\u30c7\u30fc\u30bf\u30e2\u30c7\u30eb\u306e\u81ea\u52d5\u5909\u63db\u306e\u3068\u3053\u308d\u306b\u3082\u5f53\u3066\u306f\u3081\u308b\u308f\u3051\u3067\u3001\u305d\u308c\u306f\u305d\u308c\u3067\u5272\u308a\u5207\u308a\u3067\u3002\u696d\u52d9\u306e\u307b\u3046\u306f\u3001SellingcompanyName \u3068\u3044\u3046\u8aad\u307f\u53d6\u308a\u5c02\u7528\u306e\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u4f5c\u3063\u305f\u308a\u3057\u3066\u307e\u3059\u3002\n<\/p>\n<p>\n\u25a0\u30d7\u30ed\u30d1\u30c6\u30a3\u30d3\u30e5\u30fc\u3063\u307d\u3044\u3082\u306e\u3092\u4f5c\u308b\n<\/p>\n<p>\n\u30ea\u30b9\u30c8\u30d3\u30e5\u30fc\u3092\u30af\u30ea\u30c3\u30af\u3057\u305f\u3068\u304d\u306e\u5185\u5bb9\u3092\u8868\u793a\u3055\u305b\u307e\u3059\u3002<br \/>\n\u30ea\u30b9\u30c8\u30d3\u30e5\u30fc\u3068\u4f3c\u305f\u5f62\u3067 Item \u3068\u3044\u3046\u540d\u524d\u3067 DataContext \u3078\u30d0\u30a4\u30f3\u30c9\u3057\u3066\u304a\u304d\u307e\u3059\u3002\u3053\u306e\u300cItem\u300d\u306e\u90e8\u5206\u306f\u3001\u81ea\u5206\u3067\u597d\u304d\u306a\u3088\u3046\u306b\u8a2d\u5b9a\u3067\u304d\u307e\u3059\u3002\n<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n&lt;TextBox \r\n    Text=&amp;quot;{Binding Item.ID}&amp;quot;\r\n    Grid.Column=&amp;quot;1&amp;quot; HorizontalAlignment=&amp;quot;Left&amp;quot; Height=&amp;quot;23&amp;quot; Margin=&amp;quot;10,13,0,0&amp;quot; Grid.Row=&amp;quot;1&amp;quot; TextWrapping=&amp;quot;Wrap&amp;quot; VerticalAlignment=&amp;quot;Top&amp;quot; Width=&amp;quot;162&amp;quot;\/&gt;\r\n&lt;TextBox \r\n    Text=&amp;quot;{Binding Item.Name}&amp;quot;\r\n    Grid.Column=&amp;quot;1&amp;quot; HorizontalAlignment=&amp;quot;Left&amp;quot; Height=&amp;quot;23&amp;quot; Margin=&amp;quot;10,41,0,0&amp;quot; Grid.Row=&amp;quot;1&amp;quot; TextWrapping=&amp;quot;Wrap&amp;quot;  VerticalAlignment=&amp;quot;Top&amp;quot; Width=&amp;quot;162&amp;quot;\/&gt;\r\n&lt;TextBox \r\n    Text=&amp;quot;{Binding Item.Sellingcompany.Name}&amp;quot;\r\n    Grid.Column=&amp;quot;1&amp;quot; HorizontalAlignment=&amp;quot;Left&amp;quot; Height=&amp;quot;23&amp;quot; Margin=&amp;quot;10,69,0,0&amp;quot; Grid.Row=&amp;quot;1&amp;quot; TextWrapping=&amp;quot;Wrap&amp;quot;  VerticalAlignment=&amp;quot;Top&amp;quot; Width=&amp;quot;162&amp;quot;\/&gt;\r\n&lt;TextBox \r\n    Text=&amp;quot;{Binding Item.Areagroup.Name}&amp;quot;\r\n    Grid.Column=&amp;quot;1&amp;quot; HorizontalAlignment=&amp;quot;Left&amp;quot; Height=&amp;quot;23&amp;quot; Margin=&amp;quot;10,97,0,0&amp;quot; Grid.Row=&amp;quot;1&amp;quot; TextWrapping=&amp;quot;Wrap&amp;quot; VerticalAlignment=&amp;quot;Top&amp;quot; Width=&amp;quot;162&amp;quot;\/&gt;\r\n<\/pre>\n<p>\nText=&#8221;{Binding Item.ID}&#8221; \u306e\u3068\u3053\u308d\u304c\u30d0\u30a4\u30f3\u30c9\u3067\u3059\u306d\u3002\u5730\u57df\u306e\u540d\u524d\u3092\u8868\u793a\u3059\u308b\u3068\u304d\u306f Text=&#8221;{Binding Item.Areagroup.Name}&#8221; \u306a\u611f\u3058\u3067\u30d0\u30a4\u30f3\u30c9\u3055\u305b\u307e\u3059\u3002<br \/>\nTextBox \u306b\u30d0\u30a4\u30f3\u30c9\u3055\u305b\u3066\u3044\u308b\u306e\u306f\u3001\u7de8\u96c6\u3082\u3067\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u3067\u3059\u3002\u305f\u3060\u3057\u3001\u4e0d\u7528\u610f\u306b\u7de8\u96c6\u3055\u308c\u306a\u3044\u3088\u3046\u306b\u8aad\u307f\u53d6\u308a\u5c02\u7528\u306e\u3068\u304d\u3068\u7de8\u96c6\u53ef\u80fd\u306a\u3068\u304d\u306e\u30e2\u30fc\u30c9\u3092\u3064\u3051\u308b\u307b\u3046\u304c\u30d9\u30bf\u30fc\u3067\u3059\u3002\u3053\u308c\u306f\u3001IsEnabled \u306b\u5bfe\u3057\u3066\u30d0\u30a4\u30f3\u30c9\u3055\u305b\u308b\u3068\u4e00\u6c17\u306b Textbox \u3092\u8aad\u307f\u53d6\u308a\u5c02\u7528\u306b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\n<\/p>\n<p>\n\u25a0\u30d0\u30a4\u30f3\u30c9\u7528\u306e\u30e2\u30c7\u30eb\u3092\u4f5c\u308b\n<\/p>\n<p>\nWPF\u306e\u30d3\u30e5\u30fc\u306b\u30d0\u30a4\u30f3\u30c9\u3055\u305b\u308b\u30e2\u30c7\u30eb\u30af\u30e9\u30b9\u3092\u4f5c\u308a\u307e\u3059\u3002INotifyPropertyChanged \u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u3092\u4f7f\u3046\u308f\u3051\u3067\u3059\u304c\u3001Visual Studio 2012 \u306b\u5165\u3063\u3066\u3044\u308b\u30b9\u30c8\u30a2\u30a2\u30d7\u30ea\u7528\u306e BindableBase.cs \u3092\u305d\u306e\u307e\u307e\u4f7f\u3063\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u3042\u305f\u308a\u306f\u9069\u5b9c\u597d\u307f\uff06\u7528\u9014\u306b\u3042\u308f\u305b\u3066\u3002\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\npublic class BindModel : BindableBase\r\n{\r\n    private ObservableCollection&lt;Model.Store&gt; _Items;\r\n    public ObservableCollection&lt;Model.Store&gt; Items\r\n    {\r\n        get { return _Items; }\r\n        set { this.SetProperty(ref this._Items, value); }\r\n    }\r\n\r\n    private Model.Store _Item;\r\n    public Model.Store Item\r\n    {\r\n        get { return _Item; }\r\n        set { this.SetProperty(ref this._Item, value); }\r\n    }\r\n}\r\n<\/pre>\n<p>\n\u30ea\u30b9\u30c8\u306e\u307b\u3046\u306f\u3001ObservableCollection \u3092\u4f7f\u3046\u306e\u3092\u5fd8\u308c\u305a\u306b\u3002<br \/>\n\u672c\u6765\u306a\u3089\u3070 Model.Store \u30af\u30e9\u30b9\u306e\u5404\u30d7\u30ed\u30d1\u30c6\u30a3\u3082 INotifyPropertyChanged \u3092\u901a\u3059\u3079\u304d\u306a\u306e\u3067\u3059\u304c\u3001\u5358\u306a\u308b\u95b2\u89a7\u306e\u5834\u5408\u306f\u4e0d\u8981\u306a\u306e\u3067\u3053\u306e\u307e\u307e\u3067\u3002<br \/>\nItems \u30b3\u30ec\u30af\u30b7\u30e7\u30f3\u304c\u30ea\u30b9\u30c8\u30d3\u30e5\u30fc\u306b\u30d0\u30a4\u30f3\u30c9\u3059\u308b\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u3001Item \u30d7\u30ed\u30d1\u30c6\u30a3\u304c\u30d7\u30ed\u30d1\u30c6\u30a3\u30a6\u30a3\u30f3\u30c9\u30a6\u306e\u307b\u3046\u306b\u30d0\u30a4\u30f3\u30c9\u3059\u308b\u3082\u306e\u3067\u3059\u3002\n<\/p>\n<p>\n\u25a0DataContext\u306b\u8a2d\u5b9a\u3059\u308b\n<\/p>\n<p>\n\u30d3\u30e5\u30fc\u306e DataContext \u306b\u30e2\u30c7\u30eb\u3092\u7d50\u3073\u3064\u3051\u307e\u3059\u3002XAML\u306bStaticResource\u3067\u8ffd\u52a0\u3057\u3066\u3082\u3088\u3044\u306e\u3067\u3059\u304c\u3001\u597d\u307f\u30b3\u30fc\u30c9\u3067\u8a2d\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\npublic MainWindow()\r\n{\r\n    InitializeComponent();\r\n    \/\/ \u30e2\u30c7\u30eb\u3092\u30d0\u30a4\u30f3\u30c9\u3059\u308b\r\n    _model = new BindModel();\r\n    this.DataContext = _model;\r\n}\r\nprivate BindModel _model;\r\n\r\n\/\/\/ &lt;summary&gt;\r\n\/\/\/ \u4e00\u89a7\u3092\u53d6\u5f97\r\n\/\/\/ &lt;\/summary&gt;\r\n\/\/\/ &lt;param name=&amp;quot;sender&amp;quot;&gt;&lt;\/param&gt;\r\n\/\/\/ &lt;param name=&amp;quot;e&amp;quot;&gt;&lt;\/param&gt;\r\nprivate async void Button_Click(object sender, RoutedEventArgs e)\r\n{\r\n    var lst = await new Api.ApiStore().Read();\r\n    _model.Items = new ObservableCollection&lt;Model.Store&gt;(lst);\r\n\r\n    \/\/ this.lv.ItemsSource = lst;\r\n}\r\n\r\n\/\/\/ &lt;summary&gt;\r\n\/\/\/ \u9805\u76ee\u3092\u9078\u629e\r\n\/\/\/ &lt;\/summary&gt;\r\n\/\/\/ &lt;param name=&amp;quot;sender&amp;quot;&gt;&lt;\/param&gt;\r\n\/\/\/ &lt;param name=&amp;quot;e&amp;quot;&gt;&lt;\/param&gt;\r\nprivate void lv_SelectionChanged(object sender, SelectionChangedEventArgs e)\r\n{\r\n    var item = lv.SelectedItem as Model.Store;\r\n    _model.Item = item;\r\n}\r\n<\/pre>\n<p>\n\u30ea\u30b9\u30c8\u30d3\u30e5\u30fc\u306e\u66f4\u65b0\u306f\u3001_model.Items \u7d4c\u7531\u3067\u3001\u30ea\u30b9\u30c8\u30d3\u30e5\u30fc\u306e\u884c\u3092\u9078\u629e\u3057\u305f\u3068\u304d\u306f _model.Item \u7d4c\u7531\u3067\u8868\u793a\u3055\u305b\u307e\u3059\u3002<br \/>\nCakePHP \u3067\u4f5c\u3063\u305f Web API \u306e\u547c\u3073\u51fa\u3057\u304c new Api.ApiStore() \u3068\u306a\u3063\u3066\u3044\u308b\u306e\u306f\u611b\u5b0c\u3067\u3059\u3002\u672c\u6765\u306a\u3089\u3070 static \u30e1\u30bd\u30c3\u30c9\u306b\u3059\u308b\u304b\u3001\u5225\u9014 api \u7528\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30ad\u30fc\u30d7\u3057\u3066\u304a\u304f\u304b\u3068\u3044\u3046\u611f\u3058\u306a\u3093\u3067\u3059\u304c\u3001\u307e\u3042\u3001new \u4f7f\u3063\u3066\u30ac\u30b7\u30ac\u30b7\u3068\u958b\u304f\u3068\u3053\u308d\u306f Java \u3063\u307d\u3044\u3067\u3059\u306d\u3002\u3053\u306e new \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u3044\u3064\u89e3\u653e\u3055\u308c\u308b\u306e\u3060\u308d\u3046\u304b\uff1f\u3063\u3066\u306a\u3053\u3068\u306f C++ \u306e\u6642\u3060\u3051\u8003\u3048\u307e\u3059\u3002\n<\/p>\n<p>\n\u25a0Web API\u3092\u547c\u3073\u51fa\u3059\n<\/p>\n<p>\nWeb API \u306e\u547c\u3073\u51fa\u3057\u90e8\u5206\u3082\u5b9a\u578b\u306a\u306e\u3067\u3001\u4f55\u304b\u3068\u5171\u901a\u5316\u3057\u3066\u304a\u304d\u305f\u3044\u3068\u3053\u308d\u3067\u3059\u304c\u3001\u3044\u307e\u3093\u3068\u3053\u308d\u3079\u305f\u66f8\u304d\u3067\u3059\u3002\u3069\u3046\u3057\u3066\u3082 Store \u306e\u3088\u3046\u306a\u30af\u30e9\u30b9\u540d\u304c\u51fa\u3066\u304d\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u3042\u307e\u308a\u6c4e\u7528\u7684\u306b\u306f\u4f5c\u308c\u307e\u305b\u3093\u3002T4 \u4f7f\u3063\u3066\u81ea\u52d5\u751f\u6210\u3059\u308b\u3050\u3089\u3044\u304b\u306a\u3068\u3002\u30a8\u30e9\u30fc\u51e6\u7406\u304c\u304a\u304a\u3056\u3063\u3071\u306a\u306e\u306f\u3001\u6240\u8a6e\u30de\u30b9\u30bf\u30fc\u753b\u9762\u3067\u4f7f\u3046\u3082\u306e\u3060\u304b\u3089\u3067\u3059\u3002\u57fa\u672c\u306f\u30a8\u30e9\u30fc\u304c\u3067\u306a\u3044\u3068\u3044\u3046\u601d\u60f3\u3067\u3059\u306d\u3002\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\npublic async Task&lt;List&lt;Model.Store&gt;&gt; Read()\r\n{\r\n    var uri = new Uri(SERVER + &amp;quot;\/Stores.xml&amp;quot;);\r\n    var lst = new List&lt;Model.Store&gt;();\r\n    try\r\n    {\r\n        HttpClient cl = new HttpClient();\r\n        var xml = await cl.GetStringAsync(uri);\r\n        var doc = XDocument.Parse(xml);\r\n        var coll = doc.Descendants(&amp;quot;item&amp;quot;);\r\n        foreach (var it in coll)\r\n        {\r\n            var el = it.Descendants(&amp;quot;Store&amp;quot;).FirstOrDefault();\r\n            var m = new Model.Store(el);\r\n            lst.Add(m);\r\n        }\r\n    }\r\n    catch ( Exception ex )\r\n    {\r\n        \/\/ \u30a8\u30e9\u30fc\u767a\u751f\r\n        Debug.WriteLine(&amp;quot;error:{0}&amp;quot;, ex.Message);\r\n        return lst;\r\n    }\r\n    return lst;\r\n}\r\npublic async Task&lt;Model.Store&gt; Read( int id )\r\n{\r\n    var uri = new Uri(SERVER +\r\n        string.Format(&amp;quot;\/Stores\/view\/{0}.xml&amp;quot;, id));\r\n    try\r\n    {\r\n        HttpClient cl = new HttpClient();\r\n        var xml = await cl.GetStringAsync(uri);\r\n        var doc = XDocument.Parse(xml);\r\n        var el = doc.Descendants(&amp;quot;Store&amp;quot;).FirstOrDefault();\r\n        var m = new Model.Store(el);\r\n        return m; \r\n    }\r\n    catch (Exception ex)\r\n    {\r\n        \/\/ \u30a8\u30e9\u30fc\u767a\u751f\r\n        Debug.WriteLine(&amp;quot;error:{0}&amp;quot;, ex.Message);\r\n        return null;\r\n    }\r\n}\r\n<\/pre>\n<p>\nWeb API\u306e\u30a8\u30e9\u30fc\u5024\u3092\u53d6\u308b\u305f\u3081\u306b\u306f\u3001\u3082\u3046\u5c11\u3057\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u306a\u3044\u3068\u3044\u3051\u307e\u305b\u3093\u3002<br \/>\n\u3072\u3068\u307e\u305a\u3001\u3053\u3093\u306a\u611f\u3058\u3067 WPF \u304b\u3089 CakePHP \u306e Web API \u3092\u547c\u3073\u51fa\u3059\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f59\u88d5\u304c\u3042\u308b\u3046\u3061\u306bCakePHP\u3068WPF\u306e\u76f8\u4e92\u904b\u7528\u3092\u307e\u3068\u3081\u3066\u3044\u304f\uff08\u6e96\u5099\u7de8\uff09 | Moonmile Solutions Blog http:\/\/www.moonmile.net\/blog\/archives\/5329 \u306e\u7d9a\u304d\u3067 &hellip; <a href=\"http:\/\/www.moonmile.net\/blog\/archives\/5370\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[20,60],"tags":[],"class_list":["post-5370","post","type-post","status-publish","format-standard","hentry","category-cakephp","category-wpf"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/5370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/comments?post=5370"}],"version-history":[{"count":1,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/5370\/revisions"}],"predecessor-version":[{"id":5371,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/5370\/revisions\/5371"}],"wp:attachment":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/media?parent=5370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/categories?post=5370"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/tags?post=5370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}