using System; using System.Windows.Controls; using JamSoft.CALDemo.Modules.PageManager.Core; namespace JamSoft.CALDemo.Modules.Navigator { /// <summary> /// Interaction logic for NavigatorView.xaml /// </summary> public partial class NavigatorView : UserControl, INavigatorView { private IPage _selectedPage; public event EventHandler<PageEventArgs> ItemChangeRequest; public NavigatorView() { InitializeComponent(); } private void OnItemChangeRequest(IPage page) { if (ItemChangeRequest != null) { ItemChangeRequest(this, new PageEventArgs(page)); } } private INavigatorPresentationModel _model; public INavigatorPresentationModel Model { get { return _model; } set { _model = value; this.DataContext = value; } } public IPage SelectedItem { get { return theListView.SelectedItem as IPage; } set { _selectedPage = value; SetListViewItemWithoutEvent(_selectedPage); } } private void SetListViewItemWithoutEvent(IPage page) { theListView.SelectedItem = page; } private void theListView_SelectionChanged(object sender, SelectionChangedEventArgs e) { IPage listBoxSelectedPage = this.theListView.SelectedItem as IPage; if (listBoxSelectedPage != _selectedPage) SetListViewItemWithoutEvent(_selectedPage); OnItemChangeRequest(listBoxSelectedPage); } } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)