I use the prism.Unity (WPF).
I show a image in ViewA, And I want to Delete the image in ViewB
When I jump from ViewA to ViewB and delete this image
The Vistual Studio tip: The process cannot access the file '...\bin\Debug\netcoreapp3.1\Images\1.png' because it is being used by another process.
In other words, the image(Xaml) data of viewA is not been destroyed, What should I do?
// App.Xaml.cs
containerRegistry.RegisterForNavigation<ViweA>();
containerRegistry.RegisterForNavigation<ViweB>();
// ViewAViewModel.cs
_regionManager.RequestNavigate("ContentRegion", "ViweB");
ViewA and ViewB Image
Related
Scenario:
Index Resources > New Resource Form > Resource Detail
Expectations:
When I go from Index Resources to New Resource Form, the back button should go back to Index resources.
When I submit the New Resource Form, I should be taken to view the Resource Detail, the back button should go back to Index resources.
Actual Result:
When I hit the back button from Resource Detail, after the form has been submitted, it would take me back to the New Todo Form.
This is a copy of How to manipulate a back button pointer to point to a previous-previous View, but it proposes a solution using $ionicViewService, but it has been deprecated for $ionicHistory.
How to do it using $ionicHistory?
You need to override the back button in the 3rd page's controller and then use $ionicHistory.goBack() to navigate back 2 views down the stack.
// override default behaviour
$rootScope.$ionicGoBack = function() {
// Default -1, -2 goes back 2 views
$ionicHistory.goBack(-2);
};
Of course make sure that $ionicHistory and $rootScope are injected into the controller.
Resources:
https://ionicframework.com/docs/v1/api/service/$ionicHistory/
Ionic override all BACK button behaviour for specific controller
I am using a splitviewcontroller template. From the detail view I am navigating to a different view controller using a SEGUE. The problem is the new view only displays in the detail view part of the split view. I want the new view to cover entire screen or a way to completely remove master view (when new view is pushed) and push master view back later. How can i do that ?
some code examples would be helpful.
You can implement this delegate method to conditionally hide the master view:
- (BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController (UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation
{
return YES;
}
In my MainWindow.xaml, I have a DockPanel that contains Menu, Page and Status Bar. I want to show this Page when an option is clicked from the Menu. The Page should appear as centered to the parent, MainWindow. This Page will be acting as a center place to show different Forms, i.e, User Controls, Content etc..
I am not following how to add a reference in the Code-Behind .cs file of the MainWindow to show this Page.
For most things that I want to Disappear/Reappear, I set the visibililty. If you are using the codebehind for this, ensure that the page has a name:
<Page x:Name="MyPage"/>
Then you should be able to do something like:
This.MyPage.Visibility = Visibility.Collapsed;
Unless your page is a resource, If that is the case, just:
This.FindResouce("MyPage");
Out of curiosity, why do you want to use a page? I have never had cause to use one and would like to know what one needs it for.
I have a series of views that are to be displayed depending on the currently selected item in a tree within a parent view. These views are created and registered with the region during the initialization method of the parent view and are being correctly deactivated/activated, therefore giving the effect of swapping in/out the correct view. These views have a single underlying viewmodel as their datacontext, which contains data objects supporting INotifyPropertyChanged.
This solution works if there are no currently outstanding edits in progress within the child view but if there is a edit in progress in a view (i.e. the user has changed the contents of a description but hasn't clicked out of the text box) and that view is deactivated (i.e. the a different tree item is clicked within the parent view, thus causing a de-activation to occur) a NullReferenceException is being thrown in the NotifyPropertyChanged() of the underlying data object attached to the now deactivated view.
What seems to be happening is this:
An edit is started by the user in the child view
The user clicks an item in the tree in the parent view
The controller picks up the change in the selected item in the tree
The current child view is deactivated
The new view is activated
The change from the edit happens to the underlying data object (the set method is getting called)
A change notification event is generated by the data object as a result of this change
A null reference exception is thrown.
Presumably, this change notification event is being sent to the now de-activated view, but the view is not null.
I have not tried this myself, but I believe one solution was to listen for the deactivate event of the view using IActiveAware and cancel any editing.
See if this link helps.
I created one master page with navigation frame. In a child page also containing one navigation frame once Child page loaded the outer next prev buttons are not working...
instead of using the hyperlinks, create a button with a click event. Then call
this.subframe.Navigate(new Uri("/Views/AboutContent/AboutPage1.xaml", UriKind.Relative));
subframe is the name of your nested frame. That should do it
you may also have to set this property in your nested frame:
JournalOwnership="OwnsJournal"