Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Clipboard & FilePicker samples #1135

Merged

Conversation

gregwoo-microsoft
Copy link
Contributor

Added a new sample to showcase how to use the Clipboard

image

Description

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

@gregwoo-microsoft
Copy link
Contributor Author

@chingucoding let me know what you think of this new sample 😄

Copy link
Collaborator

@marcelwgn marcelwgn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really like adding these kinds of samples!

WinUIGallery/ControlPages/ClipboardPage.xaml Outdated Show resolved Hide resolved
WinUIGallery/ControlPages/ClipboardPage.xaml.cs Outdated Show resolved Hide resolved
@gregwoo-microsoft gregwoo-microsoft changed the title New Clipboard sample New Clipboard & FilePicker samples Dec 13, 2022
Copy link
Collaborator

@marcelwgn marcelwgn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great samples, only thing we could improve would be renaming the TextBlocks that show the output and maybe highlight the file(s)/folder that was picked? Maybe make it cursive?

WinUIGallery/ControlPages/FilePickerPage.xaml Outdated Show resolved Hide resolved
Comment on lines 241 to 249
var textBox = ((sender as Button).Parent as StackPanel)
.FindName("FileContentTextBox") as TextBox;
using (var stream = await file.OpenStreamForWriteAsync())
{
using (var tw = new StreamWriter(stream))
{
tw.WriteLine(textBox?.Text);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Formatting

if (file != null)
{
// Prevent updates to the remote version of the file until we finish making changes and call CompleteUpdatesAsync.
CachedFileManager.DeferUpdates(file);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line seems to crash on my machine, @gregwoo-microsoft does this also happen on your machine?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works fine for me. What kind of error are you getting?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm getting this exception:

Screenshot of InvalidCastException

@gregwoo-microsoft gregwoo-microsoft merged commit 1b747f9 into microsoft:main Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants