Image and button controls disappear from WPF window at runtime when style is applied

I have this XAML for a window:

<Window x:Class="Wormholes.Views.TitleWindow" xmlns="" xmlns:x="" xmlns:d="" xmlns:mc="" xmlns:local="clr-namespace:Wormholes" xmlns:commands="clr-namespace:Wormholes.Commands" mc:Ignorable="d" Title="Warning: Weird Wormholes!" Height="450" Width="800" WindowState="Maximized" WindowStyle="None"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="64"/> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Image Source="/Images/Splash.png" Grid.RowSpan="2" Grid.ColumnSpan="3"/> <Button Grid.Row="1" Grid.Column="0" Command="commands:Commands.StartCommand">Start</Button> <Button Grid.Row="1" Grid.Column="2" Command="commands:Commands.ExitCommand">Exit</Button> </Grid> </Window> 

However when I run my app, the image and buttons appear briefly, then disappear, and I’m left with a blank window.

I have a style in App.xaml:

<Style TargetType="{x:Type Grid}"> <Setter Property="Background" Value="Black"/> </Style> 

If I delete this style, the image and buttons remain onscreen; however the background is white, and I want it to be black. Why are my controls disappearing when the style is present, and how can I prevent this from happening? Thanks! 🙂

submitted by /u/ekolis
[link] [comments]

Leave a Reply