CurrentChangingEventHandler CurrentChangingEventHandler CurrentChangingEventHandler CurrentChangingEventHandler Delegate


Represents a method that can handle the CurrentChanging event of an ICollectionView implementation.

public : delegate void CurrentChangingEventHandler(PlatForm::Object sender, CurrentChangingEventArgs e)public delegate void CurrentChangingEventHandler(Object sender, CurrentChangingEventArgs e)Public Delegate CurrentChangingEventHandler(sender As Object, e As CurrentChangingEventArgs)// This API is not available in Javascript.
PlatForm::Object Object Object Object

The source of the event.

Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


The following code example demonstrates how to handle the CurrentChanging event. In this example, the XAML shows the content of a page with a GridView bound to a CollectionViewSource. The code-behind shows the CollectionViewSource initialization, which includes setting its Source and retrieving its View in order to attach the CurrentChanging event handler.

  <CollectionViewSource x:Name="cvs" />
  <DataTemplate x:Key="myDataTemplate">
    <Border Background="#FF939598" Width="200" Height="200">
      <TextBlock Text="{Binding Path=Name}" />

<Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
  <GridView x:Name="PicturesGrid" 
    SelectionMode="Single" CanReorderItems="False" CanDragItems="False"
    ItemsSource="{Binding Source={StaticResource cvs}}"                
    ItemTemplate="{StaticResource myDataTemplate}" >
        <WrapGrid VerticalChildrenAlignment="Top" 
          HorizontalChildrenAlignment="Left" />
protected override void OnNavigatedTo(NavigationEventArgs e)
    var library = Windows.Storage.KnownFolders.PicturesLibrary;
    var queryOptions = new Windows.Storage.Search.QueryOptions();
    queryOptions.FolderDepth = Windows.Storage.Search.FolderDepth.Deep;
    queryOptions.IndexerOption = 

    var fileQuery = library.CreateFileQueryWithOptions(queryOptions);

    var fif = new Windows.Storage.BulkAccess.FileInformationFactory(
        Windows.Storage.FileProperties.ThumbnailMode.PicturesView, 190, 

    var dataSource = fif.GetVirtualizedFilesVector();
    cvs.Source = dataSource;
    cvs.View.CurrentChanging += View_CurrentChanging;

private void View_CurrentChanging(object sender, CurrentChangingEventArgs e)
    Debug.WriteLine("Cancel = " + e.Cancel);
    Debug.WriteLine("IsCancelable = " + e.IsCancelable);
    if (e.IsCancelable == true)
        // Cancel the change. The previously selected item remains selected.
        e.Cancel = true;


The ICollectionView.CurrentChanging event occurs when the CurrentItem property value is changing. The CurrentChangingEventArgs parameter passed to the event handler specifies information about the change.

If IsCancelable is true, the event handler can cancel the change by setting Cancel to true. If the change is canceled, CurrentItem is not changed. Setting Cancel to true when IsCancelable is false raises an exception.

See Also