質問編集履歴

4

誤字修正

2018/06/07 07:22

投稿

BluOxy
BluOxy

スコア2663

test CHANGED
File without changes
test CHANGED
@@ -102,4 +102,8 @@
102
102
 
103
103
 
104
104
 
105
+ もしこの直し方で進められるのであれば、
106
+
105
- もしこの直し方で進められるのであれば、どのようにすればTemplateを定義する前のStyleの情報適用っていけるのでしょうか。
107
+ どのようにすればTemplateを定義する前のStyleを
108
+
109
+ Templateの定義後に引き継げられるできるのでしょうか。

3

コードのインデントが無かったため追加

2018/06/07 07:21

投稿

BluOxy
BluOxy

スコア2663

test CHANGED
File without changes
test CHANGED
@@ -44,27 +44,27 @@
44
44
 
45
45
  <Style x:Key="DefaultCalendarDayButtonStyle" TargetType="{x:Type CalendarDayButton}">
46
46
 
47
- <Setter Property="Template">
47
+ <Setter Property="Template">
48
48
 
49
- <Setter.Value>
49
+ <Setter.Value>
50
50
 
51
- <ControlTemplate TargetType="{x:Type CalendarDayButton}">
51
+ <ControlTemplate TargetType="{x:Type CalendarDayButton}">
52
52
 
53
- <ContentPresenter x:Name="NormalText"
53
+ <ContentPresenter x:Name="NormalText"
54
54
 
55
- Margin="5,1,5,1"
55
+ Margin="5,1,5,1"
56
56
 
57
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
57
+ HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
58
58
 
59
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
59
+ VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
60
60
 
61
- TextElement.Foreground="#FF333333"/>
61
+ TextElement.Foreground="#FF333333"/>
62
62
 
63
- </ControlTemplate>
63
+ </ControlTemplate>
64
64
 
65
- </Setter.Value>
65
+ </Setter.Value>
66
66
 
67
- </Setter>
67
+ </Setter>
68
68
 
69
69
  </Style>
70
70
 
@@ -88,13 +88,13 @@
88
88
 
89
89
  <Style x:Key="DefaultCalendarDayButtonStyle" TargetType="{x:Type CalendarDayButton}">
90
90
 
91
- <Setter Property="Background" Value="Blue"/>
91
+ <Setter Property="Background" Value="Blue"/>
92
92
 
93
- <Setter Property="Template">
93
+ <Setter Property="Template">
94
94
 
95
- <--何もしない-->
95
+ <--何もしない-->
96
96
 
97
- </Setter>
97
+ </Setter>
98
98
 
99
99
  </Style>
100
100
 

2

参考サイトのURLを貼りなおした

2018/06/07 07:19

投稿

BluOxy
BluOxy

スコア2663

test CHANGED
File without changes
test CHANGED
@@ -36,7 +36,7 @@
36
36
 
37
37
 
38
38
 
39
- [こちらのページ](http://iyemon018.hatenablog.com/?page=1484191800)を参考にし以下のようなコードに変更してみました。
39
+ [こちらのページ](http://iyemon018.hatenablog.com/entry/2016/05/10/231206)を参考にし以下のようなコードに変更してみました。
40
40
 
41
41
 
42
42
 

1

文字色を変えたことによる他機能への影響について記載

2018/06/07 07:16

投稿

BluOxy
BluOxy

スコア2663

test CHANGED
File without changes
test CHANGED
@@ -29,3 +29,77 @@
29
29
  </Style>
30
30
 
31
31
  ```
32
+
33
+
34
+
35
+ #6/7追記
36
+
37
+
38
+
39
+ [こちらのページ](http://iyemon018.hatenablog.com/?page=1484191800)を参考にし以下のようなコードに変更してみました。
40
+
41
+
42
+
43
+ ```lang-xaml
44
+
45
+ <Style x:Key="DefaultCalendarDayButtonStyle" TargetType="{x:Type CalendarDayButton}">
46
+
47
+ <Setter Property="Template">
48
+
49
+ <Setter.Value>
50
+
51
+ <ControlTemplate TargetType="{x:Type CalendarDayButton}">
52
+
53
+ <ContentPresenter x:Name="NormalText"
54
+
55
+ Margin="5,1,5,1"
56
+
57
+ HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
58
+
59
+ VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
60
+
61
+ TextElement.Foreground="#FF333333"/>
62
+
63
+ </ControlTemplate>
64
+
65
+ </Setter.Value>
66
+
67
+ </Setter>
68
+
69
+ </Style>
70
+
71
+ ```
72
+
73
+
74
+
75
+ 文字色は変更することができました。
76
+
77
+ しかし元々用意されていたCalendarの他のプロパティがTemplateの設定によりいない扱いされているみたいです。
78
+
79
+ (選択中の日付の色が変わったり、現在の日付部分だけ色が変わったりなどが無くなってしまった)
80
+
81
+
82
+
83
+ 実際に、以下のコードではBackgroundプロパティが適用されなくなってしまいます。
84
+
85
+
86
+
87
+ ```lang-xaml
88
+
89
+ <Style x:Key="DefaultCalendarDayButtonStyle" TargetType="{x:Type CalendarDayButton}">
90
+
91
+ <Setter Property="Background" Value="Blue"/>
92
+
93
+ <Setter Property="Template">
94
+
95
+ <--何もしない-->
96
+
97
+ </Setter>
98
+
99
+ </Style>
100
+
101
+ ```
102
+
103
+
104
+
105
+ もしこの直し方で進められるのであれば、どのようにすればTemplateを定義する前のStyleの情報を適用っていけるのでしょうか。