回答編集履歴
1
見直しキャンペーン中
test
CHANGED
@@ -1,147 +1,74 @@
|
|
1
1
|
`Grid`も`StackPanel`もそういう性質だから仕方がないのですが、いくつかアイデアがありました。
|
2
|
-
|
3
2
|
[Hide grid row in WPF - Stack Overflow](https://stackoverflow.com/questions/2502178/hide-grid-row-in-wpf)
|
4
|
-
|
5
|
-
|
6
3
|
|
7
4
|
xamlだけでやるとこんな感じです(2か所以上あるならコンバータのほうがいいですね)
|
8
5
|
|
9
|
-
|
10
|
-
|
11
|
-
```x
|
6
|
+
```xml
|
12
|
-
|
13
7
|
<Window
|
14
|
-
|
15
8
|
x:Class="Questions292804.MainWindow"
|
16
|
-
|
17
9
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
18
|
-
|
19
10
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
20
|
-
|
21
11
|
Width="800"
|
22
|
-
|
23
12
|
Height="450">
|
24
|
-
|
25
13
|
<Window.Resources>
|
26
|
-
|
27
14
|
<BooleanToVisibilityConverter x:Key="BoolVisibilityConverter" />
|
28
|
-
|
29
15
|
</Window.Resources>
|
30
|
-
|
31
16
|
<Grid>
|
32
|
-
|
33
17
|
<Grid.RowDefinitions>
|
34
|
-
|
35
18
|
<RowDefinition Height="Auto" />
|
36
|
-
|
37
19
|
<RowDefinition Height="Auto" />
|
38
|
-
|
39
20
|
<RowDefinition Height="Auto" />
|
40
|
-
|
41
21
|
<RowDefinition>
|
42
|
-
|
43
22
|
<RowDefinition.Style>
|
44
|
-
|
45
23
|
<Style TargetType="RowDefinition">
|
46
|
-
|
47
24
|
<Setter Property="Height" Value="*" />
|
48
|
-
|
49
25
|
<Style.Triggers>
|
50
|
-
|
51
26
|
<DataTrigger Binding="{Binding IsChecked, ElementName=R1}" Value="False">
|
52
|
-
|
53
27
|
<Setter Property="Height" Value="0" />
|
54
|
-
|
55
28
|
</DataTrigger>
|
56
|
-
|
57
29
|
</Style.Triggers>
|
58
|
-
|
59
30
|
</Style>
|
60
|
-
|
61
31
|
</RowDefinition.Style>
|
62
|
-
|
63
32
|
</RowDefinition>
|
64
|
-
|
65
33
|
<RowDefinition Height="Auto" />
|
66
|
-
|
67
34
|
<RowDefinition />
|
68
|
-
|
69
35
|
<RowDefinition Height="Auto" />
|
70
|
-
|
71
36
|
</Grid.RowDefinitions>
|
72
|
-
|
73
37
|
<RadioButton
|
74
|
-
|
75
38
|
Name="R1"
|
76
|
-
|
77
39
|
Margin="5,5,5,5"
|
78
|
-
|
79
40
|
Content="テスト"
|
80
|
-
|
81
41
|
IsChecked="True" />
|
82
|
-
|
83
42
|
<RadioButton
|
84
|
-
|
85
43
|
Name="R2"
|
86
|
-
|
87
44
|
Grid.Row="1"
|
88
|
-
|
89
45
|
Margin="5,5,5,5"
|
90
|
-
|
91
46
|
Content="テスト" />
|
92
|
-
|
93
47
|
<Button
|
94
|
-
|
95
48
|
x:Name="B1"
|
96
|
-
|
97
49
|
Grid.Row="2"
|
98
|
-
|
99
50
|
Margin="2,2,2,2"
|
100
|
-
|
101
51
|
Content="テスト"
|
102
|
-
|
103
|
-
Visibility="{Binding
|
52
|
+
Visibility="{Binding IsChecked, ElementName=R1, Converter={StaticResource BoolVisibilityConverter}}" />
|
104
|
-
|
105
53
|
<ListBox
|
106
|
-
|
107
54
|
x:Name="L1"
|
108
|
-
|
109
55
|
Grid.Row="3"
|
110
|
-
|
111
56
|
Margin="2,2,2,2"
|
112
|
-
|
113
57
|
Background="#FFBCF2F8" />
|
114
|
-
|
115
58
|
<Label
|
116
|
-
|
117
59
|
Grid.Row="4"
|
118
|
-
|
119
60
|
Margin="2,2,2,2"
|
120
|
-
|
121
61
|
Content="Log" />
|
122
|
-
|
123
62
|
<ListBox
|
124
|
-
|
125
63
|
x:Name="L2"
|
126
|
-
|
127
64
|
Grid.Row="5"
|
128
|
-
|
129
65
|
Margin="2,2,2,2"
|
130
|
-
|
131
66
|
Background="#FFBCF2F8" />
|
132
|
-
|
133
67
|
<Button
|
134
|
-
|
135
68
|
x:Name="B2"
|
136
|
-
|
137
69
|
Grid.Row="6"
|
138
|
-
|
139
70
|
Margin="2,2,2,2"
|
140
|
-
|
141
71
|
Content="テスト" />
|
142
|
-
|
143
72
|
</Grid>
|
144
|
-
|
145
73
|
</Window>
|
146
|
-
|
147
74
|
```
|