Aracılığıyla paylaş


Selector.IsSynchronizedWithCurrentItem Özellik

Tanım

bir öğesinin özelliğindeki SelectedItemItems 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

true SelectedItem, içindeki geçerli öğeyle her zaman eşitlenirseSelectedItem; false öğesi geçerli öğeyle ItemCollectionhiçbir zaman eşitlenmediyse; null yalnızca öğesi bir CollectionViewkullanıyorsa SelectedItem geçerli öğeyle eşitlenirseSelector. Varsayılan değer null değeridir.

Öznitelikler

Örnekler

Aşağıdaki örnek, iki ListBox denetimi aynı ItemsSourceöğesine bağlar. IsSynchronizedWithCurrentItem her ListBoxbirinde olarak true 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 ItemCollectionözelliğe karşılık olduğundan emin olmak için CurrentItem özelliğini true olarak ayarlayabilirsinizIsSynchronizedWithCurrentItem. Örneğin, özellikleri ItemsSource aynı kaynağa ayarlanmış iki ListBox denetim 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ı

< 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ç kimse

Şunlara uygulanır