回答編集履歴
1
見直しキャンペーン中
answer
CHANGED
@@ -1,79 +1,79 @@
|
|
1
|
-
xamlだけで雑にやるとこんなんですかね。
|
2
|
-
|
3
|
-
```
|
4
|
-
<Window
|
5
|
-
x:Class="Questions306348.MainWindow"
|
6
|
-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
7
|
-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
8
|
-
Height="450"
|
9
|
-
SizeToContent="Width">
|
10
|
-
<Window.Resources>
|
11
|
-
<Style x:Key="ListViewItemStyle" TargetType="{x:Type ListViewItem}">
|
12
|
-
<Setter Property="Template">
|
13
|
-
<Setter.Value>
|
14
|
-
<ControlTemplate TargetType="{x:Type ListViewItem}">
|
15
|
-
<DockPanel Width="1480">
|
16
|
-
<InkCanvas
|
17
|
-
x:Name="InputCanvas1"
|
18
|
-
Width="240"
|
19
|
-
Height="130"
|
20
|
-
VerticalAlignment="Bottom"
|
21
|
-
Background="White"
|
22
|
-
EditingMode="{TemplateBinding Tag}" />
|
23
|
-
<InkCanvas
|
24
|
-
x:Name="InputCanvas2"
|
25
|
-
Height="130"
|
26
|
-
VerticalAlignment="Bottom"
|
27
|
-
Background="{x:Null}"
|
28
|
-
EditingMode="{TemplateBinding Tag}" />
|
29
|
-
</DockPanel>
|
30
|
-
</ControlTemplate>
|
31
|
-
</Setter.Value>
|
32
|
-
</Setter>
|
33
|
-
</Style>
|
34
|
-
</Window.Resources>
|
35
|
-
<DockPanel>
|
36
|
-
<ListBox
|
37
|
-
x:Name="listBox"
|
38
|
-
DockPanel.Dock="Top"
|
39
|
-
SelectedIndex="0">
|
40
|
-
<ListBox.ItemsPanel>
|
41
|
-
<ItemsPanelTemplate>
|
42
|
-
<StackPanel Orientation="Horizontal" />
|
43
|
-
</ItemsPanelTemplate>
|
44
|
-
</ListBox.ItemsPanel>
|
45
|
-
<ListBox.ItemContainerStyle>
|
46
|
-
<Style TargetType="{x:Type ListBoxItem}">
|
47
|
-
<Setter Property="Template">
|
48
|
-
<Setter.Value>
|
49
|
-
<ControlTemplate>
|
50
|
-
<RadioButton
|
51
|
-
Content="{TemplateBinding ContentPresenter.Content}"
|
52
|
-
IsChecked="{Binding IsSelected, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
53
|
-
Style="{StaticResource {x:Type ToggleButton}}" />
|
54
|
-
</ControlTemplate>
|
55
|
-
</Setter.Value>
|
56
|
-
</Setter>
|
57
|
-
</Style>
|
58
|
-
</ListBox.ItemContainerStyle>
|
59
|
-
<InkCanvasEditingMode>Ink</InkCanvasEditingMode>
|
60
|
-
<InkCanvasEditingMode>EraseByPoint</InkCanvasEditingMode>
|
61
|
-
<InkCanvasEditingMode>EraseByStroke</InkCanvasEditingMode>
|
62
|
-
<InkCanvasEditingMode>Select</InkCanvasEditingMode>
|
63
|
-
<InkCanvasEditingMode>None</InkCanvasEditingMode>
|
64
|
-
</ListBox>
|
65
|
-
|
66
|
-
<ListView
|
67
|
-
x:Name="InkCanvasListView"
|
68
|
-
Background="Transparent"
|
69
|
-
BorderBrush="{x:Null}"
|
70
|
-
ItemContainerStyle="{StaticResource ListViewItemStyle}">
|
71
|
-
<ListViewItem Tag="{Binding SelectedValue, ElementName=listBox}" />
|
72
|
-
<ListViewItem Tag="{Binding SelectedValue, ElementName=listBox}" />
|
73
|
-
<ListViewItem Tag="{Binding SelectedValue, ElementName=listBox}" />
|
74
|
-
</ListView>
|
75
|
-
</DockPanel>
|
76
|
-
</Window>
|
77
|
-
```
|
78
|
-
|
1
|
+
xamlだけで雑にやるとこんなんですかね。
|
2
|
+
|
3
|
+
```xml
|
4
|
+
<Window
|
5
|
+
x:Class="Questions306348.MainWindow"
|
6
|
+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
7
|
+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
8
|
+
Height="450"
|
9
|
+
SizeToContent="Width">
|
10
|
+
<Window.Resources>
|
11
|
+
<Style x:Key="ListViewItemStyle" TargetType="{x:Type ListViewItem}">
|
12
|
+
<Setter Property="Template">
|
13
|
+
<Setter.Value>
|
14
|
+
<ControlTemplate TargetType="{x:Type ListViewItem}">
|
15
|
+
<DockPanel Width="1480">
|
16
|
+
<InkCanvas
|
17
|
+
x:Name="InputCanvas1"
|
18
|
+
Width="240"
|
19
|
+
Height="130"
|
20
|
+
VerticalAlignment="Bottom"
|
21
|
+
Background="White"
|
22
|
+
EditingMode="{TemplateBinding Tag}" />
|
23
|
+
<InkCanvas
|
24
|
+
x:Name="InputCanvas2"
|
25
|
+
Height="130"
|
26
|
+
VerticalAlignment="Bottom"
|
27
|
+
Background="{x:Null}"
|
28
|
+
EditingMode="{TemplateBinding Tag}" />
|
29
|
+
</DockPanel>
|
30
|
+
</ControlTemplate>
|
31
|
+
</Setter.Value>
|
32
|
+
</Setter>
|
33
|
+
</Style>
|
34
|
+
</Window.Resources>
|
35
|
+
<DockPanel>
|
36
|
+
<ListBox
|
37
|
+
x:Name="listBox"
|
38
|
+
DockPanel.Dock="Top"
|
39
|
+
SelectedIndex="0">
|
40
|
+
<ListBox.ItemsPanel>
|
41
|
+
<ItemsPanelTemplate>
|
42
|
+
<StackPanel Orientation="Horizontal" />
|
43
|
+
</ItemsPanelTemplate>
|
44
|
+
</ListBox.ItemsPanel>
|
45
|
+
<ListBox.ItemContainerStyle>
|
46
|
+
<Style TargetType="{x:Type ListBoxItem}">
|
47
|
+
<Setter Property="Template">
|
48
|
+
<Setter.Value>
|
49
|
+
<ControlTemplate>
|
50
|
+
<RadioButton
|
51
|
+
Content="{TemplateBinding ContentPresenter.Content}"
|
52
|
+
IsChecked="{Binding IsSelected, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
53
|
+
Style="{StaticResource {x:Type ToggleButton}}" />
|
54
|
+
</ControlTemplate>
|
55
|
+
</Setter.Value>
|
56
|
+
</Setter>
|
57
|
+
</Style>
|
58
|
+
</ListBox.ItemContainerStyle>
|
59
|
+
<InkCanvasEditingMode>Ink</InkCanvasEditingMode>
|
60
|
+
<InkCanvasEditingMode>EraseByPoint</InkCanvasEditingMode>
|
61
|
+
<InkCanvasEditingMode>EraseByStroke</InkCanvasEditingMode>
|
62
|
+
<InkCanvasEditingMode>Select</InkCanvasEditingMode>
|
63
|
+
<InkCanvasEditingMode>None</InkCanvasEditingMode>
|
64
|
+
</ListBox>
|
65
|
+
|
66
|
+
<ListView
|
67
|
+
x:Name="InkCanvasListView"
|
68
|
+
Background="Transparent"
|
69
|
+
BorderBrush="{x:Null}"
|
70
|
+
ItemContainerStyle="{StaticResource ListViewItemStyle}">
|
71
|
+
<ListViewItem Tag="{Binding SelectedValue, ElementName=listBox}" />
|
72
|
+
<ListViewItem Tag="{Binding SelectedValue, ElementName=listBox}" />
|
73
|
+
<ListViewItem Tag="{Binding SelectedValue, ElementName=listBox}" />
|
74
|
+
</ListView>
|
75
|
+
</DockPanel>
|
76
|
+
</Window>
|
77
|
+
```
|
78
|
+
|
79
79
|
`ListView`の`ItemsSource`に何かバインドされているなら、個々に`InkCanvasEditingMode`を持たせてまとめて変更が(ちょっと無駄ですが)楽です。
|