xaml 代码
<Grid x:Name="popUpWndMask" Width="2378" Height="1255" Visibility="Collapsed" HorizontalAlignment="Left" VerticalAlignment="Top" BorderBrush="Red" BorderThickness="2">
<Border >
<Border.Background>
<media:BackdropBlurBrush x:Name="blurBrush" Amount="10" />
</Border.Background>
</Border>
<Grid x:Name="popUpWnd" Background="White" Width="375" Height="375" VerticalAlignment="Top" HorizontalAlignment="Left">
<!--<Grid.RenderTransform>
<TranslateTransform x:Name="popUpWndCoord"/>
</Grid.RenderTransform>-->
</Grid>
</Grid>
C#代码
private void Slot_ClickedEdit(object sender, RoutedEventArgs e)
{
SlotProfileButton slotBtn =(sender as SlotProfileButton);
var t = slotBtn.TransformToVisual((UIElement)(popUpWndMask));
Point screenCoords = t.TransformPoint(new Point(0, 0));
TranslateTransform coordsPos= new TranslateTransform();
coordsPos.X = screenCoords.X;
coordsPos.Y = screenCoords.Y;
popUpWnd.RenderTransform = coordsPos;
popUpWndMask.Visibility = Visibility.Visible;
}
Flyout xaml 代码
<Button width="200" height="30"
<Button.Flyout>
<Flyout>
<Grid Width="200" Height="200" Background="red" HorizontalAlignment="Right">
</Grid>
</Flyout>
</Button.Flyout>
</Button>