I am currently working on a personal win10 wpf project, a simple tool that can help me use other programs on my win10 tablet.
So one of the requirement is that this program should run in the unmaximized mode, with other applications physically underneath it. You can find few examples of this kind of behavior in virtual keyboard programs, eye-droppers, screenshot taking programs. They run on top of other applications, and you can still see the other application behind still running.
My application runs fine on the Desktop mode, because you can run multiple windows at the same time all overlapping each other. But in the tablet mode, it seems you cannot run more than 1 application at a time. Right now when I open my application, the application that was previously on the top closes itself and all I can see behind my application is the wallpaper. I cannot use the split view mode, because my application needs to be physically on top of other applications and I should be able to see the other applications through my partially transparent application.
I have already checked this link: Start another application on top most in tablet mode But this was not very useful in my case because I need my application start normally, not through another application.
I have already personally seen at least one third-party program that already does this in the desktop mode. Please help!
Below is my MainWindow.xaml code:
<Window x:Class="DictBook.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:DictBook"
xmlns:controls="clr-namespace:DictBook.Controls"
mc:Ignorable="d"
Closing="Window_Closing"
AllowsTransparency="True" WindowStyle="None"
Title="MainWindow" Height="200" SizeToContent="WidthAndHeight">
<Window.Resources>
<!--Some resources here-->
</Window.Resources>
<Window.Background>
<SolidColorBrush Opacity="0.0" Color="Black"/>
</Window.Background>
<StackPanel>
<!--Some controls here-->
</StackPanel>
Below is the MainWindow.xaml.cs
public MainWindow()
{
Debug.WriteLine("MainWindow");
Topmost = true;
InitializeComponent();
ShowInTaskbar = false;
if (Properties.Settings.Default.Top > 0 && Properties.Settings.Default.Left > 0)
{
this.Top = Properties.Settings.Default.Top;
this.Left = Properties.Settings.Default.Left;
}
PopulateMainWindow();
Properties.Settings.Default.PropertyChanged += OnPropertyChanged;
}
I suggest you to set the Window.TopMost = true.
<Window x:Class="DictBook.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:DictBook"
xmlns:controls="clr-namespace:DictBook.Controls"
mc:Ignorable="d"
Closing="Window_Closing"
AllowsTransparency="True" WindowStyle="None"
Title="MainWindow" Height="200" SizeToContent="WidthAndHeight" Topmost="True">