Free Code Snippets in C#, Net Framework, Office 365, ASP.Net,WPF, Visual Studio, SQL Server, Antivirus free
#

WPF, UWP: Create transparent app window

 

Create a transparent app window

 

A window becomes transparent with WPF when the following settings are entered in the XAML value

<Window .. AllowsTransparency="True" Background="Transparent" WindowStyle="None"  >

    <Grid  Background="Transparent">

..

 

 

Example: here the transparent WPF window, which has a transparent background and shows only the button and a visible border.

 

 

Complete sample code in XAML

<Window x:Class="wpf_Screenshot_App_to_Image_File.MainWindow"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

        xmlns:local="clr-namespace:wpf_Screenshot_App_to_Image_File"

        mc:Ignorable="d"

        Title="MainWindow" Height="350" Width="525" AllowsTransparency="True" Background="Transparent" WindowStyle="None"  >

    <Grid  Background="Transparent">

        <Border BorderBrush="Red" BorderThickness="2"></Border>

        <Button x:Name="btnScreenShot" Content="ScreenShot App to Image-File" HorizontalAlignment="Left" Margin="41,40,0,0" VerticalAlignment="Top" Width="177" Height="37"

                Click="btnScreenShot_Click"               

                />

 

    </Grid>

</Window>

 

 

Mobile
»
WPF / UWP: Canvas with relative positions and sizes
»
C #, WPF, UWP: ScreenShot to save an app or window area as a file
»
C #: Windows ScreenShot save as file
»
WPF Color Picker on Color Cube
»
WPF: Draw ColorWheel in C# by drawing Lines
»
WPF: Snap In to Next Lines of Elements
»
WPF Code: Usercontrol with customizable size at runtime
»
WPF: Save the background of a Windows app as a ScreenShot
»
WPF, UWP: Create transparent app window
»
WPF: Determine the relative position of an element

.

Contact for Jobs, Project Requests: raimund.popp@microsoft-programmierer.de