CurrentChangingEventArgs 클래스

정의

CurrentChanging 이벤트에 대한 데이터를 제공합니다.

/// [Windows.Foundation.Metadata.ContractVersion(Microsoft.UI.Xaml.WinUIContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class CurrentChangingEventArgs
[Windows.Foundation.Metadata.ContractVersion(typeof(Microsoft.UI.Xaml.WinUIContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public class CurrentChangingEventArgs
Public Class CurrentChangingEventArgs
상속
Object IInspectable CurrentChangingEventArgs
특성

예제

다음 코드 예제에서는 CurrentChanging 이벤트를 처리하는 방법을 보여 줍니다. 이 예제에서 XAML은 CollectionViewSource에 바인딩된 GridView가 있는 페이지의 콘텐츠를 표시합니다. 코드 숨김은 Source를 설정하고 CurrentChanging 이벤트 처리기를 연결하기 위해 를 검색하는 것을 포함하는 CollectionViewSource 초기화를 보여줍니다.

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

<Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
  <GridView x:Name="PicturesGrid" 
    SelectionMode="Single" CanReorderItems="False" CanDragItems="False"
    ItemsSource="{Binding Source={StaticResource cvs}}"                
    ItemTemplate="{StaticResource myDataTemplate}" >
    <GridView.ItemsPanel>
      <ItemsPanelTemplate>
        <WrapGrid VerticalChildrenAlignment="Top" 
          HorizontalChildrenAlignment="Left" />
      </ItemsPanelTemplate>
    </GridView.ItemsPanel>
  </GridView>
</Grid>
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 = 
        Windows.Storage.Search.IndexerOption.UseIndexerWhenAvailable;

    var fileQuery = library.CreateFileQueryWithOptions(queryOptions);

    var fif = new Windows.Storage.BulkAccess.FileInformationFactory(
        fileQuery, 
        Windows.Storage.FileProperties.ThumbnailMode.PicturesView, 190, 
        Windows.Storage.FileProperties.ThumbnailOptions.UseCurrentScale, 
        false);

    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;
    }
}

설명

CurrentChanging 이벤트는 ICollectionView 구현에서 CurrentItem 속성 값이 변경되면 발생합니다. ICollectionView 구현은 CurrentChangingEventArgs 생성자를 사용하여 CurrentChanging 이벤트 처리기에서 CurrentItem 변경을 취소할 수 있는지 여부를 지정합니다. IsCancelable 속성 값이 true이면 Cancel 속성을 true로 설정하여 CurrentItem 변경을 취소할 수 있습니다. 그렇지 않으면 CurrentItem 변경을 취소할 수 없습니다.

생성자

CurrentChangingEventArgs()

CurrentChangingEventArgs 클래스의 새 instance 초기화합니다.

CurrentChangingEventArgs(Boolean)

CurrentChangingEventArgs 클래스의 새 instance 초기화합니다.

속성

Cancel

CurrentItem 변경을 취소해야 하는지 여부를 나타내는 값을 가져오거나 설정합니다.

IsCancelable

CurrentItem 변경을 취소할 수 있는지 여부를 나타내는 값을 가져옵니다.

적용 대상

추가 정보