在主窗口边界上/外显示wpf内容

Dal*_*ale 6 c# wpf xaml clipping mainwindow

我试图实现重叠主窗口边界与控件的效果.很难用文字解释这一点,这也可能是为什么我很难找到有关如何做到这一点的信息,或者甚至是否可能.

下面是我试图获得的效果的一个示例(来自设计者),其中"note"对象浮动在主窗口的边界之外.

例1

然而,我在运行时获得的效果是这个(下面),内部控件被主窗口的边界剪切.

例2

有人可以告诉我这是否可能(如果可能),如果可能是一些关于我如何能够获得这种效果的建议.

小智 7

有一个控件可以实现这种行为你尝试过弹出控件吗?看看这个

这是一个例子; e"

<Window x:Class="MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" Height="350" Width="525">
<Grid>
    <ToggleButton x:Name="MainButton" Content="Show popup" VerticalAlignment="Top" HorizontalAlignment="Right"/>
    <Popup PlacementTarget="{Binding ElementName=MainButton}" Placement="Bottom" AllowsTransparency="True" IsOpen="{Binding ElementName=MainButton, Path=IsChecked}">
        <Grid>
            <Border BorderBrush="Orange" BorderThickness="1" Background="Yellow"/>
            <TextBlock Text="Lorem Ipsum is simply dummy text of the printing and typesetting industry"/>
        </Grid>            
    </Popup>
</Grid>
Run Code Online (Sandbox Code Playgroud)


Mic*_*ael 1

我认为没有办法在窗口的边界之外进行绘制。但是,您可以简单地为注释控件创建一个新窗口并将其与主窗口对齐。