Selector.IsSynchronizedWithCurrentItem Özellik

Tanım

bir öğesinin özelliğindeki SelectorSelectedItem geçerli öğeyle eşitlenmiş durumda tutulup tutulmayacağını belirten bir Items 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

true SelectedItem, içindeki geçerli öğeyle her zaman eşitlenirseItemCollection; false öğesi geçerli öğeyle SelectedItemhiçbir zaman eşitlenmediyse; null yalnızca öğesi bir SelectedItemkullanıyorsa Selector geçerli öğeyle eşitlenirseCollectionView. null varsayılan değerdir.

Öznitelikler

Örnekler

Aşağıdaki örnek, iki ListBox denetimi aynı ItemsSourceöğesine bağlar. IsSynchronizedWithCurrentItem her truebirinde olarak ListBox ayarlandığından, 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 IsSynchronizedWithCurrentItemözelliğe karşılık olduğundan emin olmak için true özelliğini CurrentItem olarak ayarlayabilirsinizItemCollection. Örneğin, özellikleri ListBox aynı kaynağa ayarlanmış iki ItemsSource denetim olduğunu varsayalım. IsSynchronizedWithCurrentItem Her birindeki seçili öğenin aynı olduğundan emin olmak için her true iki liste kutusunda olarak ayarlayınListBox.

XAML Öznitelik Kullanımı

< NesneIsSynchronizedWithCurrentItem=""Boolean/>

-veya-

< NesneIsSynchronizedWithCurrentItem=""{}/>

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

Öğe Değer
Tanımlayıcı alanı IsSynchronizedWithCurrentItemProperty
Meta veri özellikleri olarak ayarlandı true Hiçbiri

Şunlara uygulanır