Repository navigation
How to show a topmost window without get the focus? #15805
|
I have a method that shows a window, which is called by a Timer. I want to display the ClockWindow every 30 minutes. However, when the window is created, it gets the focus and interrupts my full-screen application. How can I prevent this from happening? Here is the method I am using: Dispatcher.UIThread.Invoke(() =>
{
new ClockWindow().Show();
});ClockWindow.axaml: <Window xmlns="https://github.com/avaloniaui"
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"
mc:Ignorable="d" d:DesignWidth="340" d:DesignHeight="100"
Width="300"
Height="100"
x:Class="TestAvaMvvm.Views.ClockWindow"
TransparencyLevelHint="AcrylicBlur"
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"
ExtendClientAreaTitleBarHeightHint="-1"
SystemDecorations="BorderOnly"
Focusable="False"
Title="ClockWindow"
xmlns:vm="using:TestAvaMvvm.ViewModels"
x:DataType="vm:ClockWindowViewModel"
WindowStartupLocation="Manual"
Position="0,120"
Topmost="True">
<Design.DataContext>
<vm:ClockWindowViewModel />
</Design.DataContext>
<Panel>
<ExperimentalAcrylicBorder IsHitTestVisible="False">
<ExperimentalAcrylicBorder.Material>
<ExperimentalAcrylicMaterial
BackgroundSource="Digger"
TintColor="Black"
TintOpacity="0.1"
MaterialOpacity="0.1" />
</ExperimentalAcrylicBorder.Material>
</ExperimentalAcrylicBorder>
<TextBlock Foreground="White" FontSize="65"
HorizontalAlignment="Center" VerticalAlignment="Center"
TextDecorations="Underline"
Text="{Binding CurrentTime }"
>
</TextBlock>
</Panel>
</Window> |
Answered by
Pratham95VP
May 30, 2024
Replies: 1 comment 1 reply
|
try this or
|
1 reply
Answer selected by
mcthesw
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
try this
or
<Window .... ShowActivated="False" ...></Window>