开发者

Get Name of ScatterviewItem in a Scatterview with binding

开发者 https://www.devze.com 2023-02-14 18:38 出处:网络
I started to program for Microsoft Surface and I have a problem. I\'m using scatterview <s:ScatterView Name=\"MainScatterView\" ContactLeave=\"MainScatterView_ContactLeave\" ContactEnter=\"MainS

I started to program for Microsoft Surface and I have a problem.

I'm using scatterview

<s:ScatterView Name="MainScatterView" ContactLeave="MainScatterView_ContactLeave" ContactEnter="MainScatterView_ContactEnter">
        <s:ScatterView.ItemTemplate>
            <DataTemplate>
                <Image Name="picture" Source="{Binding}"/>
            </DataTemplate>
        </s:ScatterView.ItemTemplate>

    </s:ScatterView>



protected override void OnInitialized(EventArgs e)
    {
        base.OnInitialized(e);

        try
        {
            MainScatterView.ItemsSource =
                System.IO.Directory.GetFiles(@"C:\Surface_App_Dam\img\", "*.png");
        }
        catch (System.IO.DirectoryNotFoundException)
        {
            // Handle exception as needed.
        }
    }

I would like to get the name of item I've moved with "ContactLeave="MainScatterView_开发者_如何学编程ContactLeave", but I don't know how can I do that.

Could you help me please?

Thank you.


private void MainScatterView_PreviewContactUp(object sender, ContactEventArgs e)
    {
        if (e.GetPosition(this).X < 100 && (coordinates.Height - e.GetPosition(this).Y) < 100)
        {
            string file = e.OriginalSource.ToString();
            UserNotifications.RequestNotification("Notification PreviewContactUp", file, TimeSpan.FromSeconds(2));
        }
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消