Surface SDK 中 ScatterViewItem 位置更改的事件处理程序?

发布于 2024-12-04 18:54:37 字数 1244 浏览 1 评论 0原文

有谁知道在 ScatterViewItem 失去动量并在屏幕上轻弹后停止时捕获 ScatterViewItem 位置(中心属性)的简单方法?我设置了一个“热点”区域,我想在该项目在其范围内停止时启动文件传输。

到目前为止,我已经尝试了 PropertyChanged 通知,但没有成功:

    ---OvelayWrapper.xaml.cs---
    ---------------------------
    public event PropertyChangedEventHandler PropertyChanged;

    public Point CurrentLocation
    {
        get
        {
            return _CurrentLocation;
        }
        set
        {
            _CurrentLocation = value;
            OnPropertyChanged("CurrentLocation");
        }
    }
    protected void OnPropertyChanged(string newLoc)
    {
        PropertyChangedEventHandler handler = PropertyChanged;
        if (handler != null)
        {
            handler(this, new PropertyChangedEventArgs(newLoc));
        }
        Console.WriteLine("New Location Recorded");
    }


    ---OverlayWrapper.xaml---
    -------------------------
    <s:ScatterViewItem Center="{Binding Path=CurrentLocation}">
            <Label Content="Test" />
    </s:ScatterViewItem>

ScatterViewItems 有一个 SizedChanged 事件处理程序,我用它来跟踪缩放,但是 TranslationChanged 事件处理程序不存在是没有意义的。

另外,我无法使用 ScatterViewItem 的 ManipulationStarting/Delta/Completed 事件。

提前谢谢,

-Z

Does anyone know of an easy way to capture a ScatterViewItem's position (Center property) once it loses momentum and comes to a stop after being flicked across the screen? I have a "hotspot" area set up that I'd like to initiate a file transfer from once the item comes to a stop within its bounds.

So far I've tried a PropertyChanged Notification with no success:

    ---OvelayWrapper.xaml.cs---
    ---------------------------
    public event PropertyChangedEventHandler PropertyChanged;

    public Point CurrentLocation
    {
        get
        {
            return _CurrentLocation;
        }
        set
        {
            _CurrentLocation = value;
            OnPropertyChanged("CurrentLocation");
        }
    }
    protected void OnPropertyChanged(string newLoc)
    {
        PropertyChangedEventHandler handler = PropertyChanged;
        if (handler != null)
        {
            handler(this, new PropertyChangedEventArgs(newLoc));
        }
        Console.WriteLine("New Location Recorded");
    }


    ---OverlayWrapper.xaml---
    -------------------------
    <s:ScatterViewItem Center="{Binding Path=CurrentLocation}">
            <Label Content="Test" />
    </s:ScatterViewItem>

ScatterViewItems have a SizedChanged event handler that I use to track scaling with, but it doesn't make sense that a TranslationChanged event handler would not exist.

Also, I'm unable to make use of the ManipulationStarting/Delta/Completed events for a ScatterViewItem.

Thanks ahead of time,

-Z

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

我做我的改变 2024-12-11 18:54:37

使用 ScatterManipulationDelta 进行位置、大小和旋转

编辑:增量未更改

Use ScatterManipulationDelta for position, size, and rotation

Edit: delta not changed

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文