回答編集履歴

1

見直しキャンペーン中

2023/07/21 08:33

投稿

TN8001
TN8001

スコア9326

test CHANGED
@@ -1,67 +1,34 @@
1
1
  `Width="*"`で済むのなら、`ListViewItem`の幅を広げれば揃います。
2
2
 
3
-
4
-
5
- ```xaml
3
+ ```xml
6
-
7
4
  <ListView ItemsSource="{x:Bind JyusyorokuList}">
8
-
9
5
  <ListView.ItemContainerStyle>
10
-
11
6
  <Style TargetType="ListViewItem">
12
-
13
7
  <Setter Property="HorizontalContentAlignment" Value="Stretch" />
14
-
15
8
  </Style>
16
-
17
9
  </ListView.ItemContainerStyle>
18
-
19
10
  <ListView.ItemTemplate>
20
-
21
11
  <DataTemplate x:DataType="local:Jyusyoroku">
22
-
23
12
  <Grid>
24
-
25
13
  <Grid.ColumnDefinitions>
26
-
27
14
  <ColumnDefinition Width="50" />
28
-
29
15
  <!--<ColumnDefinition Width="Auto" SharedSizeGroup="A" />-->
30
-
31
16
  <!-- としたいところだがUWPでは不可 -->
32
-
33
17
  <ColumnDefinition Width="*" />
34
-
35
18
  <ColumnDefinition Width="70" />
36
-
37
19
  <ColumnDefinition Width="*" />
38
-
39
20
  <ColumnDefinition Width="2*" />
40
-
41
21
  </Grid.ColumnDefinitions>
42
-
43
22
  ・・・
44
-
45
23
  </Grid>
46
-
47
24
  </DataTemplate>
48
-
49
25
  </ListView.ItemTemplate>
50
-
51
26
  </ListView>
52
-
53
27
  ```
54
-
55
28
  ---
56
29
 
57
-
58
-
59
30
  各列の最大幅に合わせたい場合は、`SharedSizeGroup`がないので簡単にはできないですね。
60
-
61
31
  `DataGrid`でやるほうが楽だと思います。
62
32
 
63
-
64
-
65
33
  [NuGet Gallery | Microsoft.Toolkit.Uwp.UI.Controls.DataGrid](https://www.nuget.org/packages/Microsoft.Toolkit.Uwp.UI.Controls.DataGrid/)
66
-
67
34
  [DataGrid XAML Control - Windows Community Toolkit | Microsoft Docs](https://docs.microsoft.com/ja-jp/windows/communitytoolkit/controls/datagrid)