質問編集履歴
4
誤字修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -50,4 +50,6 @@
|
|
50
50
|
</Style>
|
51
51
|
```
|
52
52
|
|
53
|
+
もしこの直し方で進められるのであれば、
|
53
|
-
|
54
|
+
どのようにすればTemplateを定義する前のStyleを
|
55
|
+
Templateの定義後に引き継げられるできるのでしょうか。
|
3
コードのインデントが無かったため追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -21,17 +21,17 @@
|
|
21
21
|
|
22
22
|
```lang-xaml
|
23
23
|
<Style x:Key="DefaultCalendarDayButtonStyle" TargetType="{x:Type CalendarDayButton}">
|
24
|
-
<Setter Property="Template">
|
24
|
+
<Setter Property="Template">
|
25
|
-
<Setter.Value>
|
25
|
+
<Setter.Value>
|
26
|
-
<ControlTemplate TargetType="{x:Type CalendarDayButton}">
|
26
|
+
<ControlTemplate TargetType="{x:Type CalendarDayButton}">
|
27
|
-
<ContentPresenter x:Name="NormalText"
|
27
|
+
<ContentPresenter x:Name="NormalText"
|
28
|
-
Margin="5,1,5,1"
|
28
|
+
Margin="5,1,5,1"
|
29
|
-
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
29
|
+
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
30
|
-
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
30
|
+
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
31
|
-
TextElement.Foreground="#FF333333"/>
|
31
|
+
TextElement.Foreground="#FF333333"/>
|
32
|
-
</ControlTemplate>
|
32
|
+
</ControlTemplate>
|
33
|
-
</Setter.Value>
|
33
|
+
</Setter.Value>
|
34
|
-
</Setter>
|
34
|
+
</Setter>
|
35
35
|
</Style>
|
36
36
|
```
|
37
37
|
|
@@ -43,10 +43,10 @@
|
|
43
43
|
|
44
44
|
```lang-xaml
|
45
45
|
<Style x:Key="DefaultCalendarDayButtonStyle" TargetType="{x:Type CalendarDayButton}">
|
46
|
-
<Setter Property="Background" Value="Blue"/>
|
46
|
+
<Setter Property="Background" Value="Blue"/>
|
47
|
-
<Setter Property="Template">
|
47
|
+
<Setter Property="Template">
|
48
|
-
<--何もしない-->
|
48
|
+
<--何もしない-->
|
49
|
-
</Setter>
|
49
|
+
</Setter>
|
50
50
|
</Style>
|
51
51
|
```
|
52
52
|
|
2
参考サイトのURLを貼りなおした
title
CHANGED
File without changes
|
body
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
|
18
18
|
#6/7追記
|
19
19
|
|
20
|
-
[こちらのページ](http://iyemon018.hatenablog.com/
|
20
|
+
[こちらのページ](http://iyemon018.hatenablog.com/entry/2016/05/10/231206)を参考にし以下のようなコードに変更してみました。
|
21
21
|
|
22
22
|
```lang-xaml
|
23
23
|
<Style x:Key="DefaultCalendarDayButtonStyle" TargetType="{x:Type CalendarDayButton}">
|
1
文字色を変えたことによる他機能への影響について記載
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,4 +13,41 @@
|
|
13
13
|
</Setter.Value>
|
14
14
|
</Setter>
|
15
15
|
</Style>
|
16
|
-
```
|
16
|
+
```
|
17
|
+
|
18
|
+
#6/7追記
|
19
|
+
|
20
|
+
[こちらのページ](http://iyemon018.hatenablog.com/?page=1484191800)を参考にし以下のようなコードに変更してみました。
|
21
|
+
|
22
|
+
```lang-xaml
|
23
|
+
<Style x:Key="DefaultCalendarDayButtonStyle" TargetType="{x:Type CalendarDayButton}">
|
24
|
+
<Setter Property="Template">
|
25
|
+
<Setter.Value>
|
26
|
+
<ControlTemplate TargetType="{x:Type CalendarDayButton}">
|
27
|
+
<ContentPresenter x:Name="NormalText"
|
28
|
+
Margin="5,1,5,1"
|
29
|
+
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
30
|
+
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
31
|
+
TextElement.Foreground="#FF333333"/>
|
32
|
+
</ControlTemplate>
|
33
|
+
</Setter.Value>
|
34
|
+
</Setter>
|
35
|
+
</Style>
|
36
|
+
```
|
37
|
+
|
38
|
+
文字色は変更することができました。
|
39
|
+
しかし元々用意されていたCalendarの他のプロパティがTemplateの設定によりいない扱いされているみたいです。
|
40
|
+
(選択中の日付の色が変わったり、現在の日付部分だけ色が変わったりなどが無くなってしまった)
|
41
|
+
|
42
|
+
実際に、以下のコードではBackgroundプロパティが適用されなくなってしまいます。
|
43
|
+
|
44
|
+
```lang-xaml
|
45
|
+
<Style x:Key="DefaultCalendarDayButtonStyle" TargetType="{x:Type CalendarDayButton}">
|
46
|
+
<Setter Property="Background" Value="Blue"/>
|
47
|
+
<Setter Property="Template">
|
48
|
+
<--何もしない-->
|
49
|
+
</Setter>
|
50
|
+
</Style>
|
51
|
+
```
|
52
|
+
|
53
|
+
もしこの直し方で進められるのであれば、どのようにすればTemplateを定義する前のStyleの情報を適用っていけるのでしょうか。
|