Selector.IsSynchronizedWithCurrentItem Property

Gets or sets a value that indicates whether a Selector should keep the SelectedItem synchronized with the current item in the Items property.

Namespace: System.Windows.Controls.Primitives
Assembly: PresentationFramework (in presentationframework.dll)
XML Namespace:

[TypeConverterAttribute("System.Windows.NullableBoolConverter, PresentationFramework, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35, Custom=null")] 
public Nullable<bool> IsSynchronizedWithCurrentItem { get; set; }
/** @property */
public Nullable<boolean> get_IsSynchronizedWithCurrentItem ()

/** @property */
public void set_IsSynchronizedWithCurrentItem (Nullable<boolean> value)

public function get IsSynchronizedWithCurrentItem () : Nullable<boolean>

public function set IsSynchronizedWithCurrentItem (value : Nullable<boolean>)

<object IsSynchronizedWithCurrentItem="Boolean"/>- or -<object IsSynchronizedWithCurrentItem="{x:Null}"/>

Property Value

true if the SelectedItem is always synchronized with the current item in the ItemCollection; false if the SelectedItem is never synchronized with the current item; a null reference (Nothing in Visual Basic) if the SelectedItem is synchronized with the current item only if the Selector uses a CollectionView. The default value is a null reference (Nothing in Visual Basic).

You can set the IsSynchronizedWithCurrentItem property to true to ensure that the item selected always corresponds to the CurrentItem property in the ItemCollection. For example, suppose that there are two ListBox controls with their ItemsSource property set to the same source. Set IsSynchronizedWithCurrentItem to true on both list boxes to ensure that the selected item in each ListBox is the same.

The following example shows how to use the IsSynchronizedWithCurrentItem property with a ListBox.

<ListBox Name="myListBox" HorizontalAlignment="Left" SelectionMode="Extended" 
      Width="265" Height="55" Background="HoneyDew" SelectionChanged="myListBox_SelectionChanged"
      ItemsSource="{Binding Source={StaticResource Colors}}" IsSynchronizedWithCurrentItem="true">

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0