こんにちは。
Windows10でWPFのアプリケーションを開発しています。
Visual Studio 2015 Communityを使っています。
###前提・実現したいこと
背景にイメージを配置したウィンドウを表示したいです。
Imageの手前にGridとStackPanelとTextBlockを配置し、それぞれ背景をTransparentにしました。
VisualStudioのxamlのウィンドウでは、背景のimage(background.png)が透けて見えているのですが、実行すると白い背景になってしまいます。
なぜでしょう?
###発生している問題・エラーメッセージ
実行すると白い背景になってしまいます。
###該当のソースコード
xaml
1<Window x:Class="TransparentBackground.MainWindow" 2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 4 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 5 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 6 xmlns:local="clr-namespace:TransparentBackground" 7 mc:Ignorable="d" 8 Title="MainWindow" Height="350" Width="525"> 9 <Grid> 10 <Image Source="pack://siteoforigin:,,,/Resources/background.png" Stretch="UniformToFill" /> 11 <Grid x:Name="Grid1" Background="Transparent"></Grid> 12 <StackPanel x:Name="StackPanel1" Background="Transparent"> 13 <TextBlock Height="100" Width="100" Background="Transparent">testtext</TextBlock> 14 </StackPanel> 15 </Grid> 16</Window> 17
###補足情報(言語/FW/ツール等のバージョンなど)
Microsoft Visual Studio Community 2015
Version 14.0.25424.00 Update 3
Microsoft .NET Framework
Version 4.6.01038
インストールしているバージョン:Community
Visual C# 2015 00322-20000-00000-AA575
Microsoft Visual C# 2015
です。
よろしくお願いします。

回答1件
あなたの回答
tips
プレビュー