質問編集履歴

1

add

2016/09/01 05:47

投稿

cancat
cancat

スコア313

test CHANGED
File without changes
test CHANGED
@@ -207,3 +207,107 @@
207
207
  です。
208
208
 
209
209
  よろしくお願いします。
210
+
211
+
212
+
213
+ さらに、
214
+
215
+
216
+
217
+ ```xaml
218
+
219
+ <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
220
+
221
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
222
+
223
+ xmlns:local="clr-namespace:StyleButton">
224
+
225
+
226
+
227
+ <ControlTemplate x:Key="buttonTemplate" TargetType="Button">
228
+
229
+ <Border Name="border" BorderThickness="0" BorderBrush="Transparent">
230
+
231
+ <Border.Background>
232
+
233
+ <ImageBrush ImageSource="pack://siteoforigin:,,,/Resources/background.png" />
234
+
235
+ </Border.Background>
236
+
237
+ <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
238
+
239
+ </Border>
240
+
241
+
242
+
243
+ <ControlTemplate.Triggers>
244
+
245
+ <Trigger Property="IsPressed" Value="True">
246
+
247
+ <Setter TargetName="border" Property="Background" >
248
+
249
+ <Setter.Value>
250
+
251
+ <ImageBrush ImageSource="pack://siteoforigin:,,,/Resources/pushed.png" />
252
+
253
+ </Setter.Value>
254
+
255
+ </Setter>
256
+
257
+ </Trigger>
258
+
259
+ </ControlTemplate.Triggers>
260
+
261
+ </ControlTemplate>
262
+
263
+ </ResourceDictionary>
264
+
265
+ ```
266
+
267
+
268
+
269
+ ```xaml
270
+
271
+ <Window.Resources>
272
+
273
+ <!--<ResourceDictionary Source="/StyleButton;component/Dictionary1.xaml"/>-->
274
+
275
+ <ResourceDictionary Source="/StyleButton;component/Dictionary2.xaml"/>
276
+
277
+ <!--Source="/アセンブリ名;component/対象XAMLのプロジェクトルートからのパス"-->
278
+
279
+ </Window.Resources>
280
+
281
+ <Viewbox Stretch="Uniform">
282
+
283
+ <StackPanel Orientation="Horizontal">
284
+
285
+ <Button Margin="10" Template="{StaticResource buttonTemplate}">はい</Button>
286
+
287
+ <Button Margin="10" Template="{StaticResource buttonTemplate}">いいえ</Button>
288
+
289
+ <Button Margin="10" Template="{StaticResource buttonTemplate}">キャンセル</Button>
290
+
291
+ </StackPanel>
292
+
293
+ </Viewbox>
294
+
295
+ ```
296
+
297
+
298
+
299
+ とすると、VisualStudioで表示できるのは同じですが、
300
+
301
+ <ImageBrush ImageSource="pack://siteoforigin:,,,/Resources/pushed.png" />
302
+
303
+
304
+
305
+ の行で、
306
+
307
+ 例外がスローされました: 'System.Windows.Markup.XamlParseException' (PresentationFramework.dll の中)
308
+
309
+
310
+
311
+ 追加情報:''System.Windows.Baml2006.TypeConverterMarkupExtension' の値の指定時に例外がスローされました。のようなerrorとなって先に進めずにいます。
312
+
313
+ よろしくお願いします。