teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

5

更に追記

2018/10/30 02:37

投稿

takabosoft
takabosoft

スコア8356

answer CHANGED
@@ -47,4 +47,38 @@
47
47
  動いてませんでした。
48
48
  "Dictionary1.xaml"のスタイルが全く適用されていませでした。
49
49
 
50
- どうしたものか(^_^;)
50
+ どうしたものか(^_^;)
51
+
52
+ ----
53
+ 追記:2018/10/30 11:30
54
+
55
+ 何度もすみません。
56
+ こちらのサイトに載っている方法でしたら、なんとか動いたようです。
57
+ [http://tkatochin.hatenablog.com/entry/20080916/1221565841](http://tkatochin.hatenablog.com/entry/20080916/1221565841)
58
+
59
+ ```xaml
60
+ <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
61
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
62
+
63
+ <ResourceDictionary.MergedDictionaries>
64
+ <ResourceDictionary Source="/PresentationFramework.AeroLite;component/themes/aerolite.normalcolor.xaml" />
65
+
66
+ <ResourceDictionary>
67
+ <Style x:Key="__Type_Button__" TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
68
+ <Setter Property="Margin" Value="5,5,5,5"/>
69
+ <Setter Property="VerticalAlignment" Value="Center"/>
70
+ <Setter Property="VerticalContentAlignment" Value="Center"/>
71
+ <Setter Property="Height" Value="25"/>
72
+ </Style>
73
+
74
+ </ResourceDictionary>
75
+
76
+ </ResourceDictionary.MergedDictionaries>
77
+
78
+ <Style TargetType="Button" BasedOn="{StaticResource __Type_Button__}"/>
79
+
80
+ </ResourceDictionary>
81
+ ```
82
+
83
+ Qiitaの記事にもThemeとStyleのマージという項目がありましたが、手元では反映されなかったので、なかなかこの辺の挙動はよくわからないです。
84
+ https://qiita.com/norimatsu_yusuke/items/3a7a22f0d852d99e18cc

4

やっぱだめでした。

2018/10/30 02:37

投稿

takabosoft
takabosoft

スコア8356

answer CHANGED
@@ -42,7 +42,9 @@
42
42
  </ResourceDictionary>
43
43
  ```
44
44
 
45
- こんな感じに書けば動きました。
45
+ ~~こんな感じに書けば動きました。~~
46
46
 
47
+ 動いてませんでした。
47
- DLLリソーを使わず、単体アプリでもMergedDictionaries内でエアロとは別に直接Styleを書き込んでしまうとBaseOn効かな感じでした。
48
+ "Dictionary1.xaml"のタイル全く適用されてませでした。
49
+
48
- たぶんそいう仕組みなのでょうね。こ辺詳しい方補足願えると助ります。
50
+ うしたものか(^_^;)

3

修正

2018/10/30 02:05

投稿

takabosoft
takabosoft

スコア8356

answer CHANGED
@@ -16,21 +16,33 @@
16
16
  にするとどうですか?
17
17
 
18
18
  -----
19
- 追記:
20
- 加された情報を元に手元で試しましたが問題なくエアロが効いているように見えます。
19
+ 記 2018/10/30 10:39
21
20
 
22
- ![イメー説明](c26af012b4e66aa7ae36cfea3d70e5cf.png)
21
+ Resources.dllプロェクトの方で、styles.xaml の
23
22
 
24
- AeroTestプロジェクトで「参照の追加」で「Resources.dll」を追加してあって、
25
- debugフォルダにこのDLLとエアロのDLLが入れば動くと思います。
26
-
27
- ・・・と思ったんですが
28
-
29
- > <Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
23
+ > <Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
30
24
  > <Setter Property="Margin" Value="5,5,5,5"/>
31
25
  > <Setter Property="VerticalAlignment" Value="Center"/>
32
26
  > <Setter Property="VerticalContentAlignment" Value="Center"/>
33
27
  > <Setter Property="Height" Value="25"/>
34
28
  > </Style>
35
29
 
30
+ を別のディクショナリ(例えば)Dictionary1.xamlファイルに切り出し、
31
+ styles.xaml側を
32
+
33
+ ```xaml
34
+ <ResourceDictionary
35
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
36
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
37
+
38
+ <ResourceDictionary.MergedDictionaries>
39
+ <ResourceDictionary Source="Dictionary1.xaml" />
40
+ <ResourceDictionary Source="/PresentationFramework.AeroLite;component/themes/aerolite.normalcolor.xaml" />
41
+ </ResourceDictionary.MergedDictionaries>
42
+ </ResourceDictionary>
43
+ ```
44
+
45
+ こんな感じに書けば動きました。
46
+
47
+ DLLリソースを使わず、単体アプリでもMergedDictionaries内でエアロとは別に直接Styleを書き込んでしまうとBaseOnが効かない感じでした。
36
- これが入ってると効かなくなるぽですね。しょう。
48
+ たぶんそうう仕組みでしょうこの辺詳しい方補足願えると助かります。

2

再現テスト2

2018/10/30 01:43

投稿

takabosoft
takabosoft

スコア8356

answer CHANGED
@@ -22,4 +22,15 @@
22
22
  ![イメージ説明](c26af012b4e66aa7ae36cfea3d70e5cf.png)
23
23
 
24
24
  AeroTestプロジェクトで「参照の追加」で「Resources.dll」を追加してあって、
25
- debugフォルダにこのDLLとエアロのDLLが入れば動くと思います。
25
+ debugフォルダにこのDLLとエアロのDLLが入れば動くと思います。
26
+
27
+ ・・・と思ったんですが
28
+
29
+ > <Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
30
+ > <Setter Property="Margin" Value="5,5,5,5"/>
31
+ > <Setter Property="VerticalAlignment" Value="Center"/>
32
+ > <Setter Property="VerticalContentAlignment" Value="Center"/>
33
+ > <Setter Property="Height" Value="25"/>
34
+ > </Style>
35
+
36
+ これが入ってると効かなくなるぽいですね。なんででしょう。

1

再現テスト

2018/10/30 01:12

投稿

takabosoft
takabosoft

スコア8356

answer CHANGED
@@ -13,4 +13,13 @@
13
13
 
14
14
  > <ResourceDictionary Source="ResourceDictionary.xaml"/>
15
15
 
16
- にするとどうですか?
16
+ にするとどうですか?
17
+
18
+ -----
19
+ 追記:
20
+ 追加された情報を元に手元で試しましたが問題なくエアロが効いているように見えます。
21
+
22
+ ![イメージ説明](c26af012b4e66aa7ae36cfea3d70e5cf.png)
23
+
24
+ AeroTestプロジェクトで「参照の追加」で「Resources.dll」を追加してあって、
25
+ debugフォルダにこのDLLとエアロのDLLが入れば動くと思います。