This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SomeViewModel : INotifyPropertyChanged, INotifyDataErrorInfo | |
{ | |
errorsContainer = new ErrorsContainer<string>(x => ErrorsChanged?.Invoke(this, new DataErrorsChangedEventArgs(x))); | |
public IEnumerable GetErrors(string propertyName) | |
{ | |
return errorsContainer.GetErrors(propertyName); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SomeViewModel : BindableBase | |
{ | |
errorsContainer = new ErrorsContainer<string>(x => ErrorsChanged?.Invoke(this, new DataErrorsChangedEventArgs(x))); | |
public IEnumerable GetErrors(string propertyName) | |
{ | |
return errorsContainer.GetErrors(propertyName); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SampleViewModel: BindableBase, INavigationAware | |
{ | |
... | |
private IRegionNavigationJournal journal; | |
public void OnNavigatedTo(NavigationContext navigationContext) | |
{ | |
journal = navigationContext.NavigationService.Journal | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Sending Navigation Parameters | |
var parameters = new NavigationParameters(); | |
parameters.Add("SomeParamater", "SomeParameterValue"); | |
regionManager.RequestNavigate("Navigation", "viewName", parameters); | |
-- Receiving Navigation Parameters | |
public class SampleViewModel: BindableBase, INavigationAware | |
{ | |
... | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SampleViewModel: BindableBase, INavigationAware | |
{ | |
... | |
public const string Name = "SampleView"; | |
public bool IsNavigationTarget(NavigationContext navigationContext) | |
{ | |
return navigationContext.Uri.OriginalString.Equals(Name)? true : false | |
} | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface INavigationAware | |
{ | |
/// <summary> | |
/// Called when the implementer has been navigated to. | |
/// </summary> | |
/// <param name="navigationContext">The navigation context.</param> | |
void OnNavigatedTo(NavigationContext navigationContext); | |
/// <summary> | |
/// Called to determine if this instance can handle the navigation request. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Register | |
unityContainer.RegisterType<object, SomeView>("viewName"); | |
unityContainer.RegisterType<object, SomeOtherView>("someOtherViewName"); | |
-- Usage | |
regionManager.RequestNavigate("Navigation", "viewName"); | |
regionManager.RequestNavigate("Navigation", "someOtherViewName"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public object LoadContent(IRegion region, NavigationContext navigationContext) | |
{ | |
if (region == null) | |
throw new ArgumentNullException(nameof(region)); | |
if (navigationContext == null) | |
throw new ArgumentNullException(nameof(navigationContext)); | |
string candidateTargetContract = this.GetContractFromNavigationContext(navigationContext); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--xaml | |
<ItemsControl prism:RegionManager.RegionName="Navigation"/> | |
regionManager.Region[“Navigation”].Add(SomeView); | |
regionManager.Region[“Navigation”].Add(SomeView); | |
regionManager.Region[“Navigation”].Add(SomeView); | |
unityContainer.RegisterType<object, SomeView>("viewName"); | |
regionManager.RequestNavigate(“Navigation”, “viewName”); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--xaml | |
<ItemControl prism:RegionManager.RegionName="Navigation"> | |
regionManager.Region[“Navigation”].Add(SomeView); | |
unityContainer.RegisterType<object, SomeView>("viewName"); | |
regionManager.RequestNavigate(“Navigation”, “viewName”); |
NewerOlder