{"id":828,"date":"2021-03-13T20:02:19","date_gmt":"2021-03-13T11:02:19","guid":{"rendered":"https:\/\/todosoft.net\/blog\/?p=828"},"modified":"2021-03-14T05:38:36","modified_gmt":"2021-03-13T20:38:36","slug":"post-828","status":"publish","type":"post","link":"https:\/\/todosoft.net\/blog\/?p=828","title":{"rendered":"ListView\u3092\u6a2a\u4e26\u3073\u306b\u3059\u308b"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"287\" height=\"101\" src=\"https:\/\/todosoft.net\/blog\/wp-content\/uploads\/2021\/03\/0d40a5e4a645fc6b96e767d64ac0878e.png\" alt=\"\" class=\"wp-image-830\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">MainWindow.xaml<\/h2>\n\n\n\n<pre class=\"wp-block-luxe-blocks-syntaxhighlighter line-numbers language-csharp\"><code class=\"language-csharp\">&lt;Window x:Class=\"WpfApp8.MainWindow\"\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:local=\"clr-namespace:WpfApp8\"\n        mc:Ignorable=\"d\"\n        Title=\"MainWindow\" Height=\"450\" Width=\"800\">\n    &lt;StackPanel Orientation=\"Horizontal\">\n        \n        &lt;!-- \u7e26\u4e26\u3073 -->\n        &lt;ListView ItemsSource=\"{Binding Path=ArrayData}\">\n            &lt;ListView.ItemTemplate>\n                &lt;DataTemplate>\n                    &lt;TextBlock Text=\"{Binding}\"\/>\n                &lt;\/DataTemplate>\n            &lt;\/ListView.ItemTemplate>\n        &lt;\/ListView>\n\n        &lt;!-- \u6a2a\u4e26\u3073 -->\n        &lt;ListView ItemsSource=\"{Binding Path=ArrayData}\">\n            &lt;ListView.ItemsPanel>\n                &lt;ItemsPanelTemplate>\n                    &lt;StackPanel Orientation=\"Horizontal\"\/>\n                &lt;\/ItemsPanelTemplate>\n            &lt;\/ListView.ItemsPanel>\n            &lt;ListView.ItemTemplate>\n                &lt;DataTemplate>\n                    &lt;TextBlock Text=\"{Binding}\"\/>\n                &lt;\/DataTemplate>\n            &lt;\/ListView.ItemTemplate>\n        &lt;\/ListView>\n\n    &lt;\/StackPanel>\n&lt;\/Window>\n<\/code><\/pre>\n\n\n\n<!--more-->\n\n\n\n<h2 class=\"wp-block-heading\">MainWindow.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.Navigation;\nusing System.Windows.Shapes;\n\nnamespace WpfApp8\n{\n    \/\/\/ &lt;summary>\n    \/\/\/ MainWindow.xaml \u306e\u76f8\u4e92\u4f5c\u7528\u30ed\u30b8\u30c3\u30af\n    \/\/\/ &lt;\/summary>\n    public partial class MainWindow : Window\n    {\n        public List&lt;string> ArrayData { get; set; } = new List&lt;string>() { \"0\", \"1\", \"2\" };\n\n        public MainWindow()\n        {\n            InitializeComponent();\n\n            this.DataContext = this;\n        }\n    }\n}\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>MainWindow.xaml<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,20,15],"tags":[48],"class_list":["post-828","post","type-post","status-publish","format-standard","hentry","category-c","category-wpf","category-15","tag-listview"],"_links":{"self":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/828","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=828"}],"version-history":[{"count":2,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/828\/revisions"}],"predecessor-version":[{"id":831,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/828\/revisions\/831"}],"wp:attachment":[{"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=828"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=828"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/todosoft.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=828"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}