teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

1

見直しキャンペーン中

2023/07/22 07:22

投稿

TN8001
TN8001

スコア10108

answer CHANGED
@@ -1,140 +1,140 @@
1
- `<Grid MinWidth="1320" MinHeight="390">`が原因です。
2
- 1320より小さくならないので`Grid`内にいるボタン類が`Window`外にはみ出ます。
3
-
4
- 試行錯誤されてxamlに混乱が見られたので、整理させていただきました。
5
- 余計なお世話だったらすいません^^;
6
-
7
- ```xaml
8
- <Window
9
- x:Class="WpfApp2.MainWindow"
10
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
11
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
12
- xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
13
- Title="MainWindow"
14
- Width="1320"
15
- Height="390"
16
- AllowsTransparency="True"
17
- Background="{x:Null}"
18
- Foreground="DarkGray"
19
- ResizeMode="CanResizeWithGrip"
20
- WindowStartupLocation="CenterScreen"
21
- WindowStyle="None">
22
- <Window.Resources>
23
- <Style x:Key="WindowButtonStyle" TargetType="Button">
24
- <Setter Property="Width" Value="30" />
25
- <Setter Property="Height" Value="30" />
26
- <Setter Property="Margin" Value="0,0,0,0" />
27
- <Setter Property="Background" Value="Transparent" />
28
- <Setter Property="BorderBrush" Value="Transparent" />
29
- <Setter Property="BorderThickness" Value="0" />
30
- </Style>
31
- </Window.Resources>
32
- <Border
33
- Background="Green"
34
- BorderThickness="1.5"
35
- CornerRadius="10">
36
- <Grid>
37
- <Grid.RowDefinitions>
38
- <RowDefinition Height="Auto" />
39
- <RowDefinition />
40
- </Grid.RowDefinitions>
41
- <StackPanel
42
- HorizontalAlignment="Right"
43
- VerticalAlignment="Top"
44
- Orientation="Horizontal"
45
- ZIndex="4">
46
- <Button
47
- Content="〇"
48
- Foreground="DarkGray"
49
- Style="{StaticResource WindowButtonStyle}" />
50
- <Button
51
- Content="-"
52
- Foreground="DarkGray"
53
- Style="{StaticResource WindowButtonStyle}" />
54
- <Button
55
- Padding="0"
56
- Content="△"
57
- Cursor="Hand"
58
- Style="{StaticResource WindowButtonStyle}" />
59
- <Button
60
- Padding="0"
61
- Content="×"
62
- Cursor="Hand"
63
- Style="{StaticResource WindowButtonStyle}" />
64
- </StackPanel>
65
- <Border
66
- Margin="0,2.5"
67
- VerticalAlignment="Top"
68
- Background="Blue"
69
- BorderThickness="1.5"
70
- CornerRadius="10">
71
- <StackPanel Orientation="Horizontal">
72
- <Image
73
- Width="65"
74
- Height="65"
75
- Margin="8,0,0,0" />
76
- <ListView
77
- x:Name="ListViewMenu"
78
- Height="60"
79
- VerticalAlignment="Top"
80
- Background="{x:Null}"
81
- Cursor="Hand"
82
- FontFamily="Arial"
83
- FontSize="14"
84
- FontWeight="Bold"
85
- Foreground="#FFBBB6B6"
86
- ScrollViewer.VerticalScrollBarVisibility="Disabled">
87
- <ListView.ItemContainerStyle>
88
- <Style TargetType="ListViewItem">
89
- <Setter Property="Template">
90
- <Setter.Value>
91
- <ControlTemplate TargetType="ListViewItem">
92
- <Border Background="Transparent">
93
- <ContentPresenter
94
- Margin="20,0"
95
- HorizontalAlignment="Center"
96
- VerticalAlignment="Center" />
97
- </Border>
98
- </ControlTemplate>
99
- </Setter.Value>
100
- </Setter>
101
- </Style>
102
- </ListView.ItemContainerStyle>
103
- <ListBox.ItemsPanel>
104
- <ItemsPanelTemplate>
105
- <StackPanel Orientation="Horizontal" />
106
- </ItemsPanelTemplate>
107
- </ListBox.ItemsPanel>
108
- <ListViewItem Name="Dash" Uid="0">
109
- <TextBlock Text="aaaa" />
110
- </ListViewItem>
111
- <ListViewItem Uid="1">
112
- <TextBlock Text="bbbb" />
113
- </ListViewItem>
114
- <ListViewItem Uid="2">
115
- <TextBlock Text="cccc" />
116
- </ListViewItem>
117
- <ListViewItem Uid="4">
118
- <TextBlock Text="dddd" />
119
- </ListViewItem>
120
- <ListViewItem Uid="6">
121
- <TextBlock Text="fffff" />
122
- </ListViewItem>
123
- <ListViewItem Uid="5">
124
- <TextBlock Text="eeeee" />
125
- </ListViewItem>
126
- <ListViewItem Uid="7">
127
- <TextBlock Text="gggg" />
128
- </ListViewItem>
129
- </ListView>
130
- </StackPanel>
131
- </Border>
132
- <Frame
133
- x:Name="Frame"
134
- Grid.Row="1"
135
- Foreground="{x:Null}"
136
- NavigationUIVisibility="Hidden" />
137
- </Grid>
138
- </Border>
139
- </Window>
1
+ `<Grid MinWidth="1320" MinHeight="390">`が原因です。
2
+ 1320より小さくならないので`Grid`内にいるボタン類が`Window`外にはみ出ます。
3
+
4
+ 試行錯誤されてxamlに混乱が見られたので、整理させていただきました。
5
+ 余計なお世話だったらすいません^^;
6
+
7
+ ```xml
8
+ <Window
9
+ x:Class="WpfApp2.MainWindow"
10
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
11
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
12
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
13
+ Title="MainWindow"
14
+ Width="1320"
15
+ Height="390"
16
+ AllowsTransparency="True"
17
+ Background="{x:Null}"
18
+ Foreground="DarkGray"
19
+ ResizeMode="CanResizeWithGrip"
20
+ WindowStartupLocation="CenterScreen"
21
+ WindowStyle="None">
22
+ <Window.Resources>
23
+ <Style x:Key="WindowButtonStyle" TargetType="Button">
24
+ <Setter Property="Width" Value="30" />
25
+ <Setter Property="Height" Value="30" />
26
+ <Setter Property="Margin" Value="0,0,0,0" />
27
+ <Setter Property="Background" Value="Transparent" />
28
+ <Setter Property="BorderBrush" Value="Transparent" />
29
+ <Setter Property="BorderThickness" Value="0" />
30
+ </Style>
31
+ </Window.Resources>
32
+ <Border
33
+ Background="Green"
34
+ BorderThickness="1.5"
35
+ CornerRadius="10">
36
+ <Grid>
37
+ <Grid.RowDefinitions>
38
+ <RowDefinition Height="Auto" />
39
+ <RowDefinition />
40
+ </Grid.RowDefinitions>
41
+ <StackPanel
42
+ HorizontalAlignment="Right"
43
+ VerticalAlignment="Top"
44
+ Orientation="Horizontal"
45
+ ZIndex="4">
46
+ <Button
47
+ Content="〇"
48
+ Foreground="DarkGray"
49
+ Style="{StaticResource WindowButtonStyle}" />
50
+ <Button
51
+ Content="-"
52
+ Foreground="DarkGray"
53
+ Style="{StaticResource WindowButtonStyle}" />
54
+ <Button
55
+ Padding="0"
56
+ Content="△"
57
+ Cursor="Hand"
58
+ Style="{StaticResource WindowButtonStyle}" />
59
+ <Button
60
+ Padding="0"
61
+ Content="×"
62
+ Cursor="Hand"
63
+ Style="{StaticResource WindowButtonStyle}" />
64
+ </StackPanel>
65
+ <Border
66
+ Margin="0,2.5"
67
+ VerticalAlignment="Top"
68
+ Background="Blue"
69
+ BorderThickness="1.5"
70
+ CornerRadius="10">
71
+ <StackPanel Orientation="Horizontal">
72
+ <Image
73
+ Width="65"
74
+ Height="65"
75
+ Margin="8,0,0,0" />
76
+ <ListView
77
+ x:Name="ListViewMenu"
78
+ Height="60"
79
+ VerticalAlignment="Top"
80
+ Background="{x:Null}"
81
+ Cursor="Hand"
82
+ FontFamily="Arial"
83
+ FontSize="14"
84
+ FontWeight="Bold"
85
+ Foreground="#FFBBB6B6"
86
+ ScrollViewer.VerticalScrollBarVisibility="Disabled">
87
+ <ListView.ItemContainerStyle>
88
+ <Style TargetType="ListViewItem">
89
+ <Setter Property="Template">
90
+ <Setter.Value>
91
+ <ControlTemplate TargetType="ListViewItem">
92
+ <Border Background="Transparent">
93
+ <ContentPresenter
94
+ Margin="20,0"
95
+ HorizontalAlignment="Center"
96
+ VerticalAlignment="Center" />
97
+ </Border>
98
+ </ControlTemplate>
99
+ </Setter.Value>
100
+ </Setter>
101
+ </Style>
102
+ </ListView.ItemContainerStyle>
103
+ <ListBox.ItemsPanel>
104
+ <ItemsPanelTemplate>
105
+ <StackPanel Orientation="Horizontal" />
106
+ </ItemsPanelTemplate>
107
+ </ListBox.ItemsPanel>
108
+ <ListViewItem Name="Dash" Uid="0">
109
+ <TextBlock Text="aaaa" />
110
+ </ListViewItem>
111
+ <ListViewItem Uid="1">
112
+ <TextBlock Text="bbbb" />
113
+ </ListViewItem>
114
+ <ListViewItem Uid="2">
115
+ <TextBlock Text="cccc" />
116
+ </ListViewItem>
117
+ <ListViewItem Uid="4">
118
+ <TextBlock Text="dddd" />
119
+ </ListViewItem>
120
+ <ListViewItem Uid="6">
121
+ <TextBlock Text="fffff" />
122
+ </ListViewItem>
123
+ <ListViewItem Uid="5">
124
+ <TextBlock Text="eeeee" />
125
+ </ListViewItem>
126
+ <ListViewItem Uid="7">
127
+ <TextBlock Text="gggg" />
128
+ </ListViewItem>
129
+ </ListView>
130
+ </StackPanel>
131
+ </Border>
132
+ <Frame
133
+ x:Name="Frame"
134
+ Grid.Row="1"
135
+ Foreground="{x:Null}"
136
+ NavigationUIVisibility="Hidden" />
137
+ </Grid>
138
+ </Border>
139
+ </Window>
140
140
  ```