質問編集履歴
5
追記内容を元に本文に情報を追記しました
title
CHANGED
File without changes
|
body
CHANGED
@@ -26,14 +26,14 @@
|
|
26
26
|
|
27
27
|
|
28
28
|
<ソリューション構成>
|
29
|
-
プロジェクト:AppCore
|
29
|
+
プロジェクト:AppCore(.Net Standardクラスライブラリ)
|
30
30
|
----- ┗Resources
|
31
31
|
---------- ┗Images
|
32
32
|
--------------- ┗Japanese
|
33
33
|
-------------------- ┗Button*_jpa.png(ビルドアクション:リソース)
|
34
34
|
※画像ファイルの番号については省略
|
35
35
|
|
36
|
-
プロジェクト:AppWPF(AppCoreを参照)
|
36
|
+
プロジェクト:AppWPF(WPFアプリ.Net Freamwork / AppCoreを参照)
|
37
37
|
----- ┣MainWindow.xaml
|
38
38
|
----- ┣Style
|
39
39
|
----- ┃ ┗Japanese
|
4
頂いた回答から新たに分かったことを追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -153,4 +153,16 @@
|
|
153
153
|
</ControlTemplate>
|
154
154
|
</ResourceDictionary>
|
155
155
|
|
156
|
-
```
|
156
|
+
```
|
157
|
+
---
|
158
|
+
|
159
|
+
2019/11/12追記:
|
160
|
+
再現しないと回答をいただきましたので、新たにAppResources(カスタムコントロールライブラリ)としてプロジェクトを追加作成し、パスを以下に変更すると実行できました。
|
161
|
+
```ここに言語を入力
|
162
|
+
|
163
|
+
<BitmapImage x:Key="ImageSource_0" UriSource="pack://application:,,,/AppResources;component/Resources/Images/Japanese/Button0_jpa.png" />
|
164
|
+
```
|
165
|
+
その為、AppCoreの構成が間違っているのではないかと推測が立ちました。
|
166
|
+
|
167
|
+
AppCoreの構成については、.Net Standard 2.0のクラスライブラリ(以前でいうPCL)で作っておりました。
|
168
|
+
関係していると思っていなかったので省いていましたが、なにやらこの辺りに原因がありそうです。
|
3
誤記修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
表題の件について、スタイルが設定されているButton_Jpa.xamlが他プロジェクトにある画像ファイルへのパス指定ができずで困っております。
|
2
2
|
|
3
|
-
ファイルの読み取りの流れとしては、MainWindows.xamlからユーザーコントロールのPage_Top.xamlを読み出し、Page_Top.xamlからリソースディクショナリのButton_Jpa.xamlを読み
|
3
|
+
ファイルの読み取りの流れとしては、MainWindows.xamlからユーザーコントロールのPage_Top.xamlを読み出し、Page_Top.xamlからリソースディクショナリのButton_Jpa.xamlを読みにいく仕様になっております。
|
4
|
+
|
4
5
|
そして、Button_Jpa.xamlのControlTemplate.Triggersにて他のプロジェクトの画像ファイルを指定しております。
|
5
6
|
|
6
7
|
エラー個所はMainWindowの
|
2
エラー個所の追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
ファイルの読み取りの流れとしては、MainWindows.xamlからユーザーコントロールのPage_Top.xamlを読み出し、Page_Top.xamlからリソースディクショナリのButton_Jpa.xamlを読み出しにいく仕様になっております。
|
4
4
|
そして、Button_Jpa.xamlのControlTemplate.Triggersにて他のプロジェクトの画像ファイルを指定しております。
|
5
5
|
|
6
|
+
エラー個所はMainWindowの
|
6
7
|
|
7
|
-
|
8
8
|
<エラー内容>
|
9
9
|
リソース 'resources/images/japanese/Button0_jpa.png' を検索できません。
|
10
10
|
|
11
11
|
|
12
|
-
<対象個所>
|
12
|
+
<対象と思われる個所>
|
13
13
|
```xaml
|
14
14
|
<!--<Button_Jpa.xaml>-->
|
15
15
|
<BitmapImage x:Key="ImageSource_0" UriSource="pack://application:,,,/AppCore;component/Resources/Images/Japanese/Button0_jpa.png" />
|
@@ -60,7 +60,7 @@
|
|
60
60
|
|
61
61
|
<!-- コンテンツ -->
|
62
62
|
<StackPanel x:Name="ContentsColum" Margin="0" Height="869" VerticalAlignment="Stretch">
|
63
|
-
<page:Page_Top VerticalAlignment="Stretch" Margin="0,0,0,0"/>
|
63
|
+
<page:Page_Top VerticalAlignment="Stretch" Margin="0,0,0,0"/> ←エラー個所
|
64
64
|
</StackPanel>
|
65
65
|
</StackPanel>
|
66
66
|
</Grid>
|
1
誤記修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -67,7 +67,36 @@
|
|
67
67
|
</Window>
|
68
68
|
```
|
69
69
|
|
70
|
+
|
70
71
|
```xaml
|
72
|
+
<!--<Page_Top.xaml>-->
|
73
|
+
<UserControl x:Class="AppWPF.UserControlObjects.Page.Page_Top"
|
74
|
+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
75
|
+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
76
|
+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
77
|
+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
78
|
+
mc:Ignorable="d"
|
79
|
+
Stylus.IsPressAndHoldEnabled="False" HorizontalAlignment="Center" VerticalAlignment="Center">
|
80
|
+
|
81
|
+
|
82
|
+
<UserControl.Resources>
|
83
|
+
<ResourceDictionary>
|
84
|
+
<ResourceDictionary.MergedDictionaries>
|
85
|
+
<ResourceDictionary Source="/AppWpf;component/Style/Japanese/Button_Jpa.xaml"/>
|
86
|
+
</ResourceDictionary.MergedDictionaries>
|
87
|
+
</ResourceDictionary>
|
88
|
+
</UserControl.Resources>
|
89
|
+
|
90
|
+
<StackPanel x:Name="CanvasTop" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center">
|
91
|
+
<StackPanel x:Name="HeaderColum" Orientation="Horizontal" Height="150" ></StackPanel>
|
92
|
+
<StackPanel x:Name="ContentsColum" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" >
|
93
|
+
<Button x:Name="ButtonTest" HorizontalAlignment="Center" VerticalAlignment="Center" Width="400" Height="400" Template="{StaticResource ResourceKey=Template_ModeButton}" Cursor="Hand"/>
|
94
|
+
</StackPanel>
|
95
|
+
</StackPanel>
|
96
|
+
</UserControl>
|
97
|
+
```
|
98
|
+
|
99
|
+
```xaml
|
71
100
|
<!--<Button_Jpa.xaml>-->
|
72
101
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
73
102
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
@@ -79,8 +108,8 @@
|
|
79
108
|
<BitmapImage x:Key="ImageSource_3" UriSource="pack://application:,,,/AppCore;component/Resources/Images/Japanese/Button3_jpa.png" />
|
80
109
|
|
81
110
|
|
82
|
-
<!--
|
111
|
+
<!-- ボタン -->
|
83
|
-
<ControlTemplate x:Key="
|
112
|
+
<ControlTemplate x:Key="Template_ModeButton" TargetType="{x:Type Button}">
|
84
113
|
<!-- 標準時の画像を表示 -->
|
85
114
|
<Border x:Name="border" BorderThickness="0" BorderBrush="Transparent" CornerRadius="200">
|
86
115
|
<Border.Background>
|
@@ -123,32 +152,4 @@
|
|
123
152
|
</ControlTemplate>
|
124
153
|
</ResourceDictionary>
|
125
154
|
|
126
|
-
```
|
127
|
-
|
128
|
-
```xaml
|
129
|
-
<!--<Page_Top.xaml>-->
|
130
|
-
<UserControl x:Class="AppWPF.UserControlObjects.Page.Page_Top"
|
131
|
-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
132
|
-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
133
|
-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
134
|
-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
135
|
-
mc:Ignorable="d"
|
136
|
-
Stylus.IsPressAndHoldEnabled="False" HorizontalAlignment="Center" VerticalAlignment="Center">
|
137
|
-
|
138
|
-
|
139
|
-
<UserControl.Resources>
|
140
|
-
<ResourceDictionary>
|
141
|
-
<ResourceDictionary.MergedDictionaries>
|
142
|
-
<ResourceDictionary Source="/AppWpf;component/Style/Japanese/Button_Jpa.xaml"/>
|
143
|
-
</ResourceDictionary.MergedDictionaries>
|
144
|
-
</ResourceDictionary>
|
145
|
-
</UserControl.Resources>
|
146
|
-
|
147
|
-
<StackPanel x:Name="CanvasTop" Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center">
|
148
|
-
<StackPanel x:Name="HeaderColum" Orientation="Horizontal" Height="150" ></StackPanel>
|
149
|
-
<StackPanel x:Name="ContentsColum" Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center" >
|
150
|
-
<Button x:Name="ButtonTest" HorizontalAlignment="Center" VerticalAlignment="Center" Width="400" Height="400" Template="{StaticResource ResourceKey=Template_SimulationMode}" Cursor="Hand"/>
|
151
|
-
</StackPanel>
|
152
|
-
</StackPanel>
|
153
|
-
</UserControl>
|
154
155
|
```
|