PNG Transparent dans la fenêtre WPF
J'essaie d'appliquer PNG image qui a de la transparence dans l'ensemble de la fenêtre, mais la fenêtre est toujours blanc.
La moindre idée de voir des PNG avec de la transparence de l'?
Merci!
C#
public SplashScreen()
{
InitializeComponent();
var myBrush = new ImageBrush();
var image = new Image
{
Source = new BitmapImage(
new Uri(
"pack://application:,,,/MyApp;component/Images/Logo.png"))
};
myBrush.ImageSource = image.Source;
Background = myBrush;
}
XAML
<Window x:Class="MyApp.SplashScreen"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Topmost="True"
Title="SplashScreen" Height="400" Width="400" WindowStartupLocation="CenterScreen" WindowStyle="None"
BorderThickness="5" ShowInTaskbar="False" ResizeMode="NoResize" >
<Grid Name="MainGrid">
<Label FontSize="10" Height="20" Foreground="White" Margin="0,0,0,0" Padding="10,0,0,5" Name="statusLabel" VerticalAlignment="Bottom"></Label>
<TextBlock Visibility="Collapsed" FontSize="10" Foreground="White" Margin="18,110,18,30" Name="appInfo" TextAlignment="Center">
</TextBlock>
<TextBlock Visibility="Collapsed" FontSize="20" Foreground="White" Margin="0,83,0,90" Name="version" TextAlignment="Center">
</TextBlock>
</Grid>
</Window>
Vous devez vous connecter pour publier un commentaire.
Beaucoup d'informations ici. Je pense que la pièce que vous êtes absent est
AllowsTransparency="True"
sur votre fenêtre.Ma fenêtre avait un arrière-plan par défaut sur elle et cela n'a pas fonctionné pour moi, sans paramètre Background="Transparent" sur la fenêtre (probablement en raison de Expression Blend), juste au cas où quelqu'un a un problème similaire comme ça.