回答編集履歴

1

見直しキャンペーン中

2023/07/25 13:15

投稿

TN8001
TN8001

スコア9326

test CHANGED
@@ -1,157 +1,79 @@
1
1
  xamlだけで雑にやるとこんなんですかね。
2
2
 
3
-
4
-
5
- ```xaml
3
+ ```xml
6
-
7
4
  <Window
8
-
9
5
  x:Class="Questions306348.MainWindow"
10
-
11
6
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
12
-
13
7
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
14
-
15
8
  Height="450"
16
-
17
9
  SizeToContent="Width">
18
-
19
10
  <Window.Resources>
20
-
21
11
  <Style x:Key="ListViewItemStyle" TargetType="{x:Type ListViewItem}">
22
-
23
12
  <Setter Property="Template">
24
-
25
13
  <Setter.Value>
26
-
27
14
  <ControlTemplate TargetType="{x:Type ListViewItem}">
28
-
29
15
  <DockPanel Width="1480">
30
-
31
16
  <InkCanvas
32
-
33
17
  x:Name="InputCanvas1"
34
-
35
18
  Width="240"
36
-
37
19
  Height="130"
38
-
39
20
  VerticalAlignment="Bottom"
40
-
41
21
  Background="White"
42
-
43
22
  EditingMode="{TemplateBinding Tag}" />
44
-
45
23
  <InkCanvas
46
-
47
24
  x:Name="InputCanvas2"
48
-
49
25
  Height="130"
50
-
51
26
  VerticalAlignment="Bottom"
52
-
53
27
  Background="{x:Null}"
54
-
55
28
  EditingMode="{TemplateBinding Tag}" />
56
-
57
29
  </DockPanel>
58
-
59
30
  </ControlTemplate>
60
-
61
31
  </Setter.Value>
62
-
63
32
  </Setter>
64
-
65
33
  </Style>
66
-
67
34
  </Window.Resources>
68
-
69
35
  <DockPanel>
70
-
71
36
  <ListBox
72
-
73
37
  x:Name="listBox"
74
-
75
38
  DockPanel.Dock="Top"
76
-
77
39
  SelectedIndex="0">
78
-
79
40
  <ListBox.ItemsPanel>
80
-
81
41
  <ItemsPanelTemplate>
82
-
83
42
  <StackPanel Orientation="Horizontal" />
84
-
85
43
  </ItemsPanelTemplate>
86
-
87
44
  </ListBox.ItemsPanel>
88
-
89
45
  <ListBox.ItemContainerStyle>
90
-
91
46
  <Style TargetType="{x:Type ListBoxItem}">
92
-
93
47
  <Setter Property="Template">
94
-
95
48
  <Setter.Value>
96
-
97
49
  <ControlTemplate>
98
-
99
50
  <RadioButton
100
-
101
51
  Content="{TemplateBinding ContentPresenter.Content}"
102
-
103
52
  IsChecked="{Binding IsSelected, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
104
-
105
53
  Style="{StaticResource {x:Type ToggleButton}}" />
106
-
107
54
  </ControlTemplate>
108
-
109
55
  </Setter.Value>
110
-
111
56
  </Setter>
112
-
113
57
  </Style>
114
-
115
58
  </ListBox.ItemContainerStyle>
116
-
117
59
  <InkCanvasEditingMode>Ink</InkCanvasEditingMode>
118
-
119
60
  <InkCanvasEditingMode>EraseByPoint</InkCanvasEditingMode>
120
-
121
61
  <InkCanvasEditingMode>EraseByStroke</InkCanvasEditingMode>
122
-
123
62
  <InkCanvasEditingMode>Select</InkCanvasEditingMode>
124
-
125
63
  <InkCanvasEditingMode>None</InkCanvasEditingMode>
126
-
127
64
  </ListBox>
128
-
129
65
 
130
-
131
66
  <ListView
132
-
133
67
  x:Name="InkCanvasListView"
134
-
135
68
  Background="Transparent"
136
-
137
69
  BorderBrush="{x:Null}"
138
-
139
70
  ItemContainerStyle="{StaticResource ListViewItemStyle}">
140
-
141
71
  <ListViewItem Tag="{Binding SelectedValue, ElementName=listBox}" />
142
-
143
72
  <ListViewItem Tag="{Binding SelectedValue, ElementName=listBox}" />
144
-
145
73
  <ListViewItem Tag="{Binding SelectedValue, ElementName=listBox}" />
146
-
147
74
  </ListView>
148
-
149
75
  </DockPanel>
150
-
151
76
  </Window>
152
-
153
77
  ```
154
78
 
155
-
156
-
157
79
  `ListView`の`ItemsSource`に何かバインドされているなら、個々に`InkCanvasEditingMode`を持たせてまとめて変更が(ちょっと無駄ですが)楽です。