質問編集履歴

3

xamlの内容を追加

2017/09/24 13:25

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -18,21 +18,47 @@
18
18
 
19
19
  ###該当のソースコード
20
20
 
21
- ```XAML
21
+ ```XML
22
22
 
23
- <ListBox ItemsSource="{Binding Path=Hoge">
23
+ <UserControl
24
24
 
25
- <ListBox.ItemContainerStyle >
25
+ xmlns:……省略>
26
26
 
27
- <Style TargetType="{x:Type ListBoxItem}">
28
27
 
29
- <Setter Property="IsSelected" Value="{Binding Path=IsSelected , Mode=OneWay}"/>
30
28
 
31
- </Style>
29
+ <UserControl.DataContext>
32
30
 
33
- </ListBox.ItemContainerStyle>
31
+ <vm:MyViewModel/>
34
32
 
33
+ </UserControl.DataContext>
34
+
35
+
36
+
37
+ 前略
38
+
39
+
40
+
41
+ <ListBox ItemsSource="{Binding Path=Hoge">
42
+
43
+ <ListBox.ItemContainerStyle >
44
+
45
+ <Style TargetType="{x:Type ListBoxItem}">
46
+
47
+ <Setter Property="IsSelected" Value="{Binding Path=IsSelected , Mode=OneWay}"/>
48
+
49
+ </Style>
50
+
51
+ </ListBox.ItemContainerStyle>
52
+
35
- </ListBox>
53
+ </ListBox>
54
+
55
+
56
+
57
+ 後略
58
+
59
+
60
+
61
+ </UserControl>
36
62
 
37
63
  ```
38
64
 

2

題名を変更

2017/09/24 13:25

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- ItemContainerStyleを使わずにListBoxのItemにBindする方法
1
+ ListBoxのItemのIsSelectedを、ResourceDictionaryと共存させつつBindする方法
test CHANGED
@@ -11,8 +11,6 @@
11
11
  ResourceDictionaryの見た目を反映しつつ、IsSelectedをBindingする方法がありましたら教えてください。
12
12
 
13
13
 
14
-
15
- ※題名には「ItemContainerStyleを使わずに」とありますが、ResourceDictionaryが反映させられるのであれば使っても全然問題ありません。
16
14
 
17
15
 
18
16
 

1

タグを追加

2017/09/24 11:35

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
File without changes