question

GuoLearn-6547 avatar image
0 Votes"
GuoLearn-6547 asked GuoLearn-6547 commented

WindowsXamlHost.Clip can not Clip

When WPF using WindowsXamlHost the WindowsXamlHost.Clip can not work ,can we made it work?

WPF:
<Window
x:Class="WpfApp1.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:local="clr-namespace:WpfApp1"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="MainWindow"
``xmlns:xhost="clr-namespace:Microsoft.Toolkit.Wpf.UI.XamlHost;assembly=Microsoft.Toolkit.Wpf.UI.XamlHost"
Width="800"
Height="450"
mc:Ignorable="d">
<Grid >
<xhost:WindowsXamlHost Width="400" Height="200" RenderTransformOrigin="0.5,0.5">
<xhost:WindowsXamlHost.Clip>
<GeometryGroup>
<RectangleGeometry>
<RectangleGeometry.Rect>
<Rect Width="100" Height="100" ></Rect>
</RectangleGeometry.Rect>
</RectangleGeometry>
</GeometryGroup>
</xhost:WindowsXamlHost.Clip>
</xhost:WindowsXamlHost>
</Grid>
</Window>

windows-wpf
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi,@ GuoLearn-6547. A WindowsXamlHost is hosted in a separate HWND that is always drawn on top of the WPF elements. It is like the Windows Forms control in WindowsFormsHost, which limits many functions, such as overlays. WindowsXamlhost.Clip may also be affected.

0 Votes 0 ·

Thank you anyway

0 Votes 0 ·

Hi,@ GuoLearn-6547. I checked the SetLayeredWindowAttributes function, it may not be implemented.

0 Votes 0 ·
Show more comments

0 Answers