FileRemovedEventArgs FileRemovedEventArgs FileRemovedEventArgs FileRemovedEventArgs FileRemovedEventArgs Class

Definition

Provides information about a fileremoved event.

public : sealed class FileRemovedEventArgs : IFileRemovedEventArgs
struct winrt::Windows::Storage::Pickers::Provider::FileRemovedEventArgs : IFileRemovedEventArgs
public sealed class FileRemovedEventArgs : IFileRemovedEventArgs
Public NotInheritable Class FileRemovedEventArgs Implements IFileRemovedEventArgs
// This class does not provide a public constructor.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0 - for Xbox, see UWP features that aren't yet supported on Xbox)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Examples

The File picker sample demonstrates how to respond to a fileremoved event.


// Event handler
private async void OnFileRemoved(FileOpenPickerUI sender, FileRemovedEventArgs args)
{
    // Perform tasks when an item is removed from the file picker, like updating buttons or notifying the user

    // Make sure that the item was removed from the file picker matches the one we added.
    if (args.Id == id)
    {
        // The event handler may be invoked on a background thread,
        // so use the Dispatcher to run the UI-related code on the UI thread.
        await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
        {
            OutputTextBlock.Text = Status.FileRemoved;
            UpdateButtonState(false);
        });
     }
}

// Register for the event
fileOpenPickerUI.FileRemoved += new TypedEventHandler<FileOpenPickerUI, FileRemovedEventArgs>(OnFileRemoved);

// Event handler
function onFileRemovedFromBasket(e) {
    // Perform tasks when an item is removed from the file picker, like updating buttons or notifying the user

    // Add any code to be called when an item is removed from the basket by the user
    WinJS.log && WinJS.log(SdkSample.fileRemoved, "sample", "status");

    // Adjust the add/remove buttons based on removal
    updateSelectionState(e.id, false);
};

// Register for the event
fileOpenPickerUI.addEventListener("fileremoved", onFileRemovedFromBasket, false);

Both args and e (in C# and JS respectively) contain a FileRemovedEventArgs object.

For JavaScript, SdkSample.fileRemoved is an app variable that contains a string that used to used to notify the user.

For C#, id is an app variable that gets an identifier for the file and UpdateButtonState is one of the app's helper methods.

Remarks

This object is passed to the event handler for fileremoved events.

If your app participates in the File Open Picker contract and a fileremoved event fires, you should respond by updating its file picker app page to reflect the change in the list of chosen files.

Register for this event by adding an event listener to the fileOpenPickerUI and assigning a handler function for the event. You can access information about the event from the fileRemovedEventArgs object that is passed to your event handler.

Properties

Id Id Id Id Id

Gets the identifier of the file that the user removed from the list of chosen files in the file picker. This identifier was set by the providing app when it added the files to the list of chosen files.

See Also