Setting a background image on a WPF image control?
Image
has no property to allow for that, just put the Image
in a Border
and set the Border.Background
to an ImageBrush
.
No you need to images. Set the Window background to the image and set the root element background to an image
<Window.Background> <ImageBrush ImageSource="BackgroundImage.png"/></Window.Background><Grid.Background> <ImageBrush ImageSource="ForegroundImage.png"/> </Grid.Background>
As shown in tested code here set the Window background to an image brush. Notice AllowsTransparency="True" And WindowStyle="None" to drop the border.
<Window x:Class="khaosInstallerWPF.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Height="616" Width="773" ResizeMode="NoResize" Icon="images/khaos_Installer_UI.png" AllowsTransparency="True" WindowStyle="None"> <Window.Background> <ImageBrush ImageSource="images\khaos_Installer_UI.png"/> </Window.Background> <Grid Margin="0,0,0,0"></Grid></Window>
Bonus: If you are using a shaped for be sure to make your form draggable
namespace khaosInstallerWPF{ public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); MouseDown += delegate { DragMove(); }; } }}