質問編集履歴

2

ファイル名を修正いたしました。

2019/07/15 11:20

投稿

heroherohero
heroherohero

スコア38

test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,7 @@
1
+ ※すみません、最初に、記載していたソースのファイル名などを、ほかの方が分かりやすいように、置き換えていたのですが、添付している画像のエラーとの差異があったため、現状のファイル名をそのまま記載いたします。どうぞ、よろしくお願いいたします。
2
+
3
+
4
+
1
5
  お世話になっております。
2
6
 
3
7
 
@@ -44,6 +48,28 @@
44
48
 
45
49
  ```C#
46
50
 
51
+ using System;
52
+
53
+ using System.Collections.Generic;
54
+
55
+ using System.IO;
56
+
57
+ using Prism.Windows.Mvvm;
58
+
59
+ using Prism.Windows.Navigation;
60
+
61
+ using Windows.ApplicationModel.Resources;
62
+
63
+ using Windows.Storage;
64
+
65
+ using Windows.Storage.Pickers;
66
+
67
+ using Windows.UI.Xaml;
68
+
69
+ using Windows.UI.Xaml.Controls;
70
+
71
+
72
+
47
73
  namespace LearningAlbum.ViewModels
48
74
 
49
75
  {
@@ -62,7 +88,7 @@
62
88
 
63
89
 
64
90
 
65
- public class MainViewModel : ViewModelBase
91
+ public class PhotoListViewModel : ViewModelBase
66
92
 
67
93
  {
68
94
 
@@ -70,7 +96,7 @@
70
96
 
71
97
 
72
98
 
73
- public MainViewModel ()
99
+ public PhotoListViewModel()
74
100
 
75
101
  {
76
102
 
@@ -94,7 +120,7 @@
94
120
 
95
121
 
96
122
 
97
- - MainPage.xaml(一部抜粋)
123
+ - PhotoListPage.xaml(一部抜粋)
98
124
 
99
125
  ```C#
100
126
 
@@ -102,7 +128,7 @@
102
128
 
103
129
  x:Class="LearningAlbum.Views.PhotoListPage"
104
130
 
105
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
131
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
106
132
 
107
133
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
108
134
 
@@ -112,7 +138,7 @@
112
138
 
113
139
  xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
114
140
 
115
- xmlns:local="using:LearningAlbum.ViewModels"
141
+ xmlns:local="using:LearningAlbum.ViewModels"
116
142
 
117
143
  Style="{StaticResource PageStyle}"
118
144
 
@@ -124,21 +150,19 @@
124
150
 
125
151
 
126
152
 
127
- <controls:AdaptiveGridView Name="SuggestionGridView"
153
+ <controls:AdaptiveGridView Name="SuggestionGridView"
128
154
 
129
155
  Style="{StaticResource MainGridView}"
130
156
 
131
157
  SelectionChanged="SelectionChanged"
132
158
 
133
- ItemsSource="{x:Bind ViewModel._PhotoList, Mode=OneWay}"
159
+ ItemsSource="{x:Bind ViewModel._PhotoList}"
134
160
 
135
161
  StretchContentForSingleRow="False" >
136
162
 
137
163
  <controls:AdaptiveGridView.ItemTemplate>
138
164
 
139
- <!--<DataTemplate x:DataType="local:Photo">-->
140
-
141
- <DataTemplate x:DataType="local:Photo">
165
+ <DataTemplate x:DataType="local:Photo" >
142
166
 
143
167
  <StackPanel Margin="4" MaxWidth="276">
144
168
 
@@ -178,7 +202,7 @@
178
202
 
179
203
 
180
204
 
181
- MainPage.xaml.cs(コードビハインド)
205
+ PhotoListPage.xaml.cs(コードビハインド)
182
206
 
183
207
  ```C#
184
208
 
@@ -198,15 +222,15 @@
198
222
 
199
223
  {
200
224
 
201
- public sealed partial class MainPage: Page
225
+ public sealed partial class PhotoListPage : Page
202
226
 
203
227
  {
204
228
 
205
- private MainViewModel ViewModel => DataContext as MainViewModel;
229
+ private PhotoListViewModel ViewModel => DataContext as PhotoListViewModel;
206
-
207
-
208
-
230
+
231
+
232
+
209
- public MainPage()
233
+ public PhotoListPage()
210
234
 
211
235
  {
212
236
 

1

コードビハインドのソースコードを追加いたしました。

2019/07/15 11:20

投稿

heroherohero
heroherohero

スコア38

test CHANGED
File without changes
test CHANGED
@@ -94,7 +94,7 @@
94
94
 
95
95
 
96
96
 
97
- - リストMainPage.xaml(一部抜粋)
97
+ - MainPage.xaml(一部抜粋)
98
98
 
99
99
  ```C#
100
100
 
@@ -175,3 +175,47 @@
175
175
  </controls:AdaptiveGridView>
176
176
 
177
177
  ```
178
+
179
+
180
+
181
+ ◆MainPage.xaml.cs(コードビハインド)
182
+
183
+ ```C#
184
+
185
+ using System;
186
+
187
+
188
+
189
+ using LearningAlbum.ViewModels;
190
+
191
+
192
+
193
+ using Windows.UI.Xaml.Controls;
194
+
195
+
196
+
197
+ namespace LearningAlbum.Views
198
+
199
+ {
200
+
201
+ public sealed partial class MainPage: Page
202
+
203
+ {
204
+
205
+ private MainViewModel ViewModel => DataContext as MainViewModel;
206
+
207
+
208
+
209
+ public MainPage()
210
+
211
+ {
212
+
213
+ InitializeComponent();
214
+
215
+ }
216
+
217
+ }
218
+
219
+ }
220
+
221
+ ```