예제 #1
0
        private async void AppBarButton_Click_2(object sender, RoutedEventArgs e)
        {
            StackPanel panel = new StackPanel();
            TextBox    box   = new TextBox()
            {
                //Margin = new Thickness(0, 14, 0, -2)
                Text = post.content
            };
            TextBlock block = new TextBlock()
            {
                Text         = "Tap OK to continue.",
                TextWrapping = TextWrapping.Wrap
            };

            panel.Children.Add(block);
            panel.Children.Add(box);
            var dlg = new ContentDialog()
            {
                Title               = "Edit post",
                Content             = panel,
                PrimaryButtonText   = "ok",
                SecondaryButtonText = "cancel"
            };

            var dlgResult = await dlg.ShowAsync();

            if (dlgResult == ContentDialogResult.Primary)
            {
                int result = await PostManagement.EditActivity(post.postID, box.Text);

                if (result == 0)
                {
                    post = await Posts.GetActivity(post.postID);

                    this.DefaultViewModel["Item"] = post;
                }
            }
        }