Selector.IsSynchronizedWithCurrentItem Özellik

Tanım

bir öğesinin özelliğindeki SelectedItem Items geçerli öğeyle eşitlenmiş durumda tutulup tutulmayacağını belirten bir Selector değer alır veya ayarlar.

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

Özellik Değeri

Nullable<Boolean>

trueSelectedItem öğesinde ItemCollectionher zaman geçerli öğeyle eşitlenirseSelectedItem; false öğesi geçerli öğeyle hiçbir zaman eşitlenmediyse; null geçerli öğeyle eşitlenirseSelectedItem, yalnızca öğesi tarafından CollectionViewkullanılıyorsaSelector. null varsayılan değerdir.

Öznitelikler

Örnekler

Aşağıdaki örnek iki ListBox denetimi aynı ItemsSourceöğesine bağlar. IsSynchronizedWithCurrentItem her ListBoxbirinde olarak ayarlandığındantrue, seçilen öğe her iki denetim için de her zaman aynıdır

<XmlDataProvider x:Key="Employees" XPath="/Employees/*">
  <x:XData>
    <Employees xmlns="">
      <Employee Name="Terry Adams" Type="FTE" EmployeeNumber="1" />
      <Employee Name="Claire O'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"/>

Açıklamalar

Seçilen öğenin her zaman içindeki özelliğine true karşılık olduğundan emin olmak için CurrentItem özelliğini olarak ayarlayabilirsinizIsSynchronizedWithCurrentItem.ItemCollection Örneğin, özellikleri aynı kaynağa ayarlanmış iki ListBox denetim ItemsSource olduğunu varsayalım. true Her birindeki seçili öğenin aynı olduğundan emin olmak için her ListBox iki liste kutusunda olarak ayarlayınIsSynchronizedWithCurrentItem.

XAML Öznitelik Kullanımı

<Nesne IsSynchronizedWithCurrentItem ="Boolean"/>

-veya-

<Nesne IsSynchronizedWithCurrentItem ="{}"/>

Bağımlılık Özelliği Bilgileri

Tanımlayıcı alanı IsSynchronizedWithCurrentItemProperty
Meta veri özellikleri olarak ayarlandı true Hiçbiri

Şunlara uygulanır