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