Skip to content

Instantly share code, notes, and snippets.

Rohit Sharma rohits79

Block or report user

Report or block rohits79

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:594a6e1d26527ecc679d08a74bef255c
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);
}
View gist:783620332a48cf0da5bf061d95351c33
public class SomeViewModel : BindableBase
{
errorsContainer = new ErrorsContainer<string>(x => ErrorsChanged?.Invoke(this, new DataErrorsChangedEventArgs(x)));
public IEnumerable GetErrors(string propertyName)
{
return errorsContainer.GetErrors(propertyName);
}
View gist:9930b6846c33ae6619579166f02c1712
public class SampleViewModel: BindableBase, INavigationAware
{
...
private IRegionNavigationJournal journal;
public void OnNavigatedTo(NavigationContext navigationContext)
{
journal = navigationContext.NavigationService.Journal
}
View gist:28fe38caf52acb0414bc5067407e2e5f
-- Sending Navigation Parameters
var parameters = new NavigationParameters();
parameters.Add("SomeParamater", "SomeParameterValue");
regionManager.RequestNavigate("Navigation", "viewName", parameters);
-- Receiving Navigation Parameters
public class SampleViewModel: BindableBase, INavigationAware
{
...
View gist:aac6ef12776192abd6f4c319f33b6200
public class SampleViewModel: BindableBase, INavigationAware
{
...
public const string Name = "SampleView";
public bool IsNavigationTarget(NavigationContext navigationContext)
{
return navigationContext.Uri.OriginalString.Equals(Name)? true : false
}
...
View gist:d2e93baf68877d1f50ed291b5d50c1fe
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.
View gist:09631783494e63cf05e5d175daf52494
-- Register
unityContainer.RegisterType<object, SomeView>("viewName");
unityContainer.RegisterType<object, SomeOtherView>("someOtherViewName");
-- Usage
regionManager.RequestNavigate("Navigation", "viewName");
regionManager.RequestNavigate("Navigation", "someOtherViewName");
View gist:ebe5684df53038a99ef6595c41cc4366
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);
View gist:b48aed188d02e20b37e5a0f0a1243730
--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”);
View gist:bcab7130e8b602257ac0e9f46ff4f919
--xaml
<ItemControl prism:RegionManager.RegionName="Navigation">
regionManager.Region[“Navigation”].Add(SomeView);
unityContainer.RegisterType<object, SomeView>("viewName");
regionManager.RequestNavigate(“Navigation”, “viewName”);
You can’t perform that action at this time.