Selector.IsSynchronizedWithCurrentItem Selector.IsSynchronizedWithCurrentItem Selector.IsSynchronizedWithCurrentItem Selector.IsSynchronizedWithCurrentItem Property

정의

SelectorSelectedItemItems 속성의 현재 항목과 동기화된 상태로 유지하는지 여부를 나타내는 값을 가져오거나 설정합니다.Gets or sets a value that indicates whether a Selector should keep the SelectedItem synchronized with the current item in the Items property.

public:
 property Nullable<bool> IsSynchronizedWithCurrentItem { Nullable<bool> get(); void set(Nullable<bool> value); };
[System.ComponentModel.Bindable(true)]
[System.ComponentModel.TypeConverter("System.Windows.NullableBoolConverter, PresentationFramework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")]
[System.Windows.Localizability(System.Windows.LocalizationCategory.NeverLocalize)]
[System.ComponentModel.TypeConverter("System.Windows.NullableBoolConverter, PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")]
public Nullable<bool> IsSynchronizedWithCurrentItem { get; set; }
member this.IsSynchronizedWithCurrentItem : Nullable<bool> with get, set
Public Property IsSynchronizedWithCurrentItem As Nullable(Of Boolean)

속성 값

true 경우는 SelectedItem 의 현재 항목과 항상 동기화 되는 ItemCollection; false 경우는 SelectedItem 절대; 현재 항목과 동기화 null 경우는 SelectedItem 는 현재 항목 경우에만 동기화 됩니다 합니다 Selector 사용 하 여를 CollectionView입니다.if the SelectedItem is always synchronized with the current item in the ItemCollection; false if the SelectedItem is never synchronized with the current item; null if the SelectedItem is synchronized with the current item only if the Selector uses a CollectionView. 기본값은 null입니다.The default value is null.

예제

다음 예제에서는 두 개의 ListBox 컨트롤을 같은 ItemsSource합니다.The following example binds two ListBox controls to the same ItemsSource. 때문에 IsSynchronizedWithCurrentItem 로 설정 된 trueListBox, 선택한 항목 동일 항상 두 컨트롤Because IsSynchronizedWithCurrentItem is set to true on each ListBox, the selected item is always the same for both controls

<XmlDataProvider x:Key="Employees" XPath="/Employees/*">
  <x:XData>
    <Employees xmlns="">
      <Employee Name="Terry Adams" Type="FTE" EmployeeNumber="1" />
      <Employee Name="Claire O&apos;Donnell" Type="FTE" EmployeeNumber="12345" />
      <Employee Name="Palle Peterson" Type="FTE" EmployeeNumber="5678" />
      <Employee Name="Amy E. Alberts" Type="CSG" EmployeeNumber="99222" />
      <Employee Name="Stefan Hesse" Type="Vendor" EmployeeNumber="-" />
    </Employees>
  </x:XData>
</XmlDataProvider>

<DataTemplate x:Key="EmployeeItemTemplate">
  <TextBlock Text="{Binding XPath=@Name}" />
</DataTemplate>
<ListBox Name="employeeListBox1"
         ItemsSource="{Binding Source={StaticResource Employees}}"
         ItemTemplate="{StaticResource EmployeeItemTemplate}"
         IsSynchronizedWithCurrentItem="True"/>

<ListBox Name="employeeListBox2"
         ItemsSource="{Binding Source={StaticResource Employees}}"
         ItemTemplate="{StaticResource EmployeeItemTemplate}"
         IsSynchronizedWithCurrentItem="True"/>

설명

설정할 수 있습니다는 IsSynchronizedWithCurrentItem 속성을 true 항상 선택한 항목에 해당 하는지 확인 하는 CurrentItem 속성에는 ItemCollection합니다.You can set the IsSynchronizedWithCurrentItem property to true to ensure that the item selected always corresponds to the CurrentItem property in the ItemCollection. 예를 들어, 두 개의 ListBox 컨트롤과 해당 ItemsSource 속성이 동일한 원본으로 설정 합니다.For example, suppose that there are two ListBox controls with their ItemsSource property set to the same source. 설정 IsSynchronizedWithCurrentItemtrue 두 목록 상자에서 선택한 항목에 각 되도록 ListBox 동일 합니다.Set IsSynchronizedWithCurrentItem to true on both list boxes to ensure that the selected item in each ListBox is the same.

XAML 특성 사용XAML Attribute Usage

<object IsSynchronizedWithCurrentItem="Boolean"/><object IsSynchronizedWithCurrentItem="Boolean"/>

또는-or-

<object IsSynchronizedWithCurrentItem="{}"/><object IsSynchronizedWithCurrentItem="{}"/>

종속성 속성 정보Dependency Property Information

식별자 필드Identifier field IsSynchronizedWithCurrentItemProperty
메타 데이터 속성 설정Metadata properties set to true 없음None

적용 대상