So my Xamarin.Forms app uses Prism, and it works mostly fine.
I have created a settings page with uses Switches to make certain choices and as such I have a Toggle event handler in the code behind which also works, does what it is supposed to.
The problem I am having now is to try and stop the toggle method from triggering when navigating from the page, which it automatically does on navigation.
I found a solution for this for a previous prism version, 7.0.0.396, by stopping the method in the ondisappearing method and doing
protected override void OnDisappearing()
{
base.OnDisappearing();
switch.Toggled -= switch_OnToggled;
}
this works fine because the ondiappearing method triggers and stops the toggle events before they are triggered by the navigation, but it doesn't work for the newer prism versions because in the newer version the toggle methods are triggering before the ondisappearing method can stop them.
Any suggestions on how to solve this problem would be greatly appreciated.
So I managed to solve the problem by using the Xamarin.Forms.BehaviorsPack, and using the EventToCommandBehavior to bind the events to a command in my ViewModel.
Related
In our app we use multiple floating action buttons. With Gluon 4.4.4 we added them as layers, which had the following behaviour:
Each view had it's own FAB.
When changing the view, the FAB was hiding.
When changing back to the view, the FAB was showing.
Now, with Gluon 5.0.0 (FAB's as objects) the following happens:
The buttons get stacked over each other, when they are not hidden.
When they are hidden and we change back to a view, the FAB is no longer showing.
This led to a lot of trouble and unnecessary code lines. How can we improve this or how is it intended to be used?
We could imagine to use one FAB for the whole app and exchange it's content for each view - however, this ends up in a bigger mess as well, since it would have to be declared public etc.
Any help is appreciated :-)
You are looking for the new FloatingActionButton#showOn(View) method.
This method makes sure to automatically show and hide the FAB depending on the View's showing property, removing most of the boiler code required in earlier versions to achieve the same functionality.
From the Javadocs:
Makes sure that the FAB is automatically shown when the supplied view is shown. The FAB also automatically hides when the view is hidden. This allows the developer to not worry about calling show() and hide() methods explicitly.
Im trying to built an app using xamarin forms.
I have a navigation drawer implemented using MasterDetail page. I need to reset the content of MasterDetail when user press backbutton and revist the same screen again. While trying to do this Im getting following error:
System.InvalidOperationException: Master must not already have a parent.
Any help would be really appreciated. Thanks
I ran in to this same issue as well trying to set a new MasterdetailPage() as the Application.Current.MainPage. The previous page intances inside the MasterdetailPage.Detail remain somewhere in memory, This can cause events to fire twice due to MessagingCenter not being able to unsubscribe.
Solution was to save an instance of the MasterDetailPage inside a Global variable and reuse this instance for the Application.Current.MainPage. This way no new pages are created.
You can clear parent of the new page before set the masterdetailpage instance.
newPage.Parent = null;
MyMasterDetailPage.Instance.Detail = newPage;
How to Hide the Back Button in Qt installer framework?
Please see attached image.
See my answer to Qt installer framework hide or disable buttons quoted below:
For the wizard BackButton specifically, it automatically disables itself if there are no pages before the current page a la the Introduction page.
From QtScript this can be accomplished by removing any dynamic pages before the current page with installer.removeWizardPage and disabling all default pages before the current page with installer.setDefaultPageVisible(QInstaller.Introduction, false).
There is void QWizard::setButton ( WizardButton which, QAbstractButton * button ) what means you schould be able to set a button which behaves like you need it. Derive a Class from QAbstractButton. Reimplement the paintEvent() to paint nothing and reimplement the mouseEvents to do nothing. That should do the (dirty) trick. Even if the wizard sets it to be visible, it won't draw itself and can't digest and mouse actions. Just tested it ... should work for you.
I am totaly new to this site, but I already like it :-)
I found it by searching for a question about the UIPageViewController.
I have a normal UIPageViewController App, in which I open a ModalViewController for setting up some settings...
Now the Problem: :-)
If I click on the done Button on the right side of the ModalView, to dismiss it, the PageViewController turnes the page, because he thinks that he is meant by that click ;-)
Can I disable the PageViewController GestureRecognizer as long as I have a ModalView opened?
Is there a method to disable and later his recognizer?
thank you for your help in advance...
cu Matze
It seems odd that your UIPageViewController would steal touches from a modal view presented over it. Unless, perhaps, you are embedding the modal view within the content of the UIPageViewController?
To answer your question -- you can easily disable the page view controller's gesture recognizers by enumerating its gestureRecognizers property (an NSArray):
for (UIGestureRecognizer *gr in [self.pageViewController gestureRecognizers]) {
[gr setEnabled:NO];
}
Re-enable them later with setEnabled:YES.
UPDATE:
In iOS 6 UIPageViewControllerTransitionStyleScroll has been added. UIPageViewControllers that use this transition style return no gesture recognisers in the array returned by gestureRecognizers. Presumably page view controllers with this transition style use an underlying, private UIScrollView instance (it behaves just like a UIScrollView with paging enabled), although I haven't checked this.
I am looking for an event which is fired (if any) after a chart is rendered (visible in UI) in Flash, we are using Flex SDK 3.0. We have to capture the screenshot after the chart is rendered, current implementation adds a huge delay in update_complete event callback, this is slowing down the whole job of generating images.
I tried to use EXIT_FRAME event, but this doesn't seem to serve the purpose. Any help to resolve this issue is highly appreciated.
Regards,
Dan
Adobe use this event : mx.events.FlexEvent.TRANSFORM_CHANGE
But if you want to use it, you are obligate to inherit from Chart Component classes. Take a look at DataTransform Class.
http://help.adobe.com/es_ES/FlashPlatform/reference/actionscript/3/mx/charts/chartClasses/DataTransform.html
I suggest you to look at the DisplayObject liveDoc, where there are several types of events. Some are fired before the rendering (Event.RENDER), some are fired after specific operation (ResizeEvent, for instance). But if you really want to know when you chart has been rendered, why don't you watch for the validation methods (updateDisplayList(), commitProperties()) by overriding them in a child class and fire a custom event in there ?