/// <summary> /// Handle a change to the max history count. /// </summary> /// <param name="dependencyObject">The FolderNavBar.</param> /// <param name="eventArgs">The event arguments.</param> private static void OnMaxHistoryCountChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs eventArgs) { FolderNavBar folderNavBar = dependencyObject as FolderNavBar; if (folderNavBar != null && folderNavBar.MaxHistoryCount != 0) { while (folderNavBar.history.Count > folderNavBar.MaxHistoryCount) { folderNavBar.history.RemoveAt(folderNavBar.history.Count - 1); } } }
/// <summary> /// Handles a change to the Navigation change property. /// </summary> /// <param name="dependencyObject">The object that owns the property.</param> /// <param name="dependencyPropertyChangedEventArgs">A description of the changed property.</param> private static void OnSelectedValueChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) { // Extract the variables from the generic arguments. FolderNavBar folderNavBar = dependencyObject as FolderNavBar; FolderNavNode newValue = dependencyPropertyChangedEventArgs.NewValue as FolderNavNode; folderNavBar.breadcrumb.SelectedItem = newValue; folderNavBar.history.Remove(newValue); folderNavBar.history.Insert(0, newValue); if (folderNavBar.MaxHistoryCount != 0 && folderNavBar.history.Count > folderNavBar.MaxHistoryCount) { folderNavBar.history.RemoveAt(folderNavBar.history.Count - 1); } }