1

如果没有无模式选项(?),是否有另一种方法可以在我的页面顶部制作一个小的可移动信息对话框/窗口/页面。我需要保持这个作为参考,但它是可移动的,以便可以揭示基础信息。Visual Studio 2015,未来商店应用程序。谢谢。

4

1 回答 1

1

您不能使标准对话框无模式。为了实现你想要的,你应该在页面顶部使用一个自定义面板,并连接到它的操作事件。例如:

<Grid x:Name="LayoutRoot">
    <!-- some other content -->

    <Grid x:Name="Dialog" Background="Red" Width="200" Height="100" 
          ManipulationMode="All" ManipulationDelta="Dialog_OnManipulationDelta">

        <Grid.RenderTransform>
            <CompositeTransform x:Name="DialogTransform" />
        </Grid.RenderTransform>
    </Grid>
</Grid>

和后面的代码:

 private void Dialog_OnManipulationDelta(object sender, ManipulationDeltaRoutedEventArgs args)
 {
     DialogTransform.TranslateX += args.Delta.Translation.X;
     DialogTransform.TranslateY += args.Delta.Translation.Y;
 }

然后您可以构建更复杂的逻辑,例如显示/隐藏动画、关闭按钮等。

于 2016-08-25T04:25:52.313 回答