Dismissing picker from MVVMCross DateElement - mvvmcross

I am using the DateElement in MVVMCross that was forked from Monotouch Dialog.
I can get the DatePicker to appear when I touch the DateElement, the problem is I cannot see how to dismiss the PickerView once I have selected the Date.

It was completely to do with the way we use MT D, moving the DialogViewController's View into a View one level higher than expected. See my answer to this question, Back Button missing from nested Monotouch Dialog RootElement Views

Related

How to prevent game controller button B from quitting app / navigating back to menu in tvOS

The game controller button B is, by default, quitting the app and navigating back to the tvOS home screen. At first I thought this was intuitive, but quickly realized that's what the Nimbus MENU button (dead middle of the controller) is for, and that I actually want to use button B in-game.
Setting a change handler for button B works, but the app still quits when the button is released.
GCControllerButtonValueChangedHandler buttonBHandler = ^(GCControllerButtonInput *button, float value, BOOL pressed) {
NSLog(#"B");
};
I had the same issue.
The solution was to have my main ViewController inherit from GCEventViewController instead of UIViewController.
By default, when using GCEventViewController, the MENU button will not return to the menu. In this case, if you want it to be able to return to the menu with the original behavior you can simply set controllerUserInteractionEnabled to YES.
see the documentation for this class here :
https://developer.apple.com/library/tvos/documentation/GameController/Reference/GCEventViewController_Ref/index.html
edit : apple dev forum helpep me fix this issue : https://forums.developer.apple.com/message/57926#57926
hope this helps,
I too had the issue, related to Unity, but I think this rather hacky solution can help.
Deriving from GCEventViewController one can override several methods, one of them is:
- (void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
returning or handling presses without calling super removes all calls to the internals.

WinRT: Right-Click works for selecting items. Swipe Gesture doesn't

I feel like I'm missing something obvious. I have an application which uses the 'IsSelected' property of GridViewItem to indicate that an item has been selected. When I'm using the application on a desktop computer (no touch devices) and I right-click on the item, it becomes selected. Take the same program and put it on a Surface and I can find no gestures that will select it. Swipe-down, press-and-hold; nothing seems to do the work that the Right-Click does on the desktop.
Anyone have any ideas what might be missing?
OK, got the answer and it's not pretty. In my code, I had attempted to subclass the GridView with my own control called ContentView. In XAML there is no subclassing of standard controls (you can't use the 'BasedOn' to pick up the style of built in controls) so my ContentView was not picking up the styling of a standard GridView. However, after pulling apart the standard style I've discovered the two critical features are:
IsSwipeEnabled - Must be set to true for swiping to work on the item.
ScrollViewer.VerticalScrollMode - Must be disabled so the scroll viewer doesn't try to interpret the swipe motion as a command to scroll downward.
After that, swiping to Right-Click works easy as pie.
I get what you are asking. It seems counterintuitive, huh? In this situation, my preference is to enable item clicking and use item clicking to set the selected item. If find this to be the most intuitive for users. Start with this XAML:
<GridView IsItemClickEnabled="True" ItemClick="GridView_ItemClick" />
And then simply do this:
private void GridView_ItemClick(object sender, ItemClickEventArgs e)
{
var grid = sender as GridView;
if (grid.SelectedItems.Contains(e.ClickedItem))
grid.SelectedItems.Remove(e.ClickedItem);
else
grid.SelectedItems.Add(e.ClickedItem);
}
It should work for SelectionMode Single and Multiple just fine.
Does that make sense?
// Jerry

Remove widgets from p:dashboard via dragging out

I'd like to add support to removing the widgets from p:dashboard via dragging the panel out of dashboard, such as in WordPress admin panel.
I've found out the examples of dragging the widgets between 2 dashboards, but in my case I need to have callback when the element is dragged out of dashboard, no matter where. The widget would be than removed. However, I couldn't find any example for such behaviour.
What components/tools to use to implement such functionality? I'm using PrimeFaces 3.4.
Use draggable component with dashboard keyword;
<p:draggable for="widget" dashboard=":dbForm:dashboard"/>
And check this solutions on forum page of primefaces: Dashboard Drag and Drop
Hope it'll help you.
Good Luck!

MonoTouch - IOS5 Storyboard - Additional View Controllers

I am new to Monotouch and I am not finding the right documentation to do this.
I created a new iPad Storyboard Single View application. I have my inital Navigation Controller, my initial View Controller, and then I added two more View Controllers (Pages?). I created a button on the first two pages. I held down control and dragged each button to the next View Controller and setup each Segue as a push. When I run my application, I can move from page 1 to page 3 and back, no problems.
Now the problem is when I start adding controls and trying to wire them up. On the initial View Controller, I can hold down Control and drag controls over to the code and after I give it a name, it automatically adds my outlets and actions.
But the new two View Controllers I cannot do this. I have searched every where and the StoryBoard documentation and examples are difficult to find. Any help would be appreciated. Thanks!
You need to create a UIViewController class for each of the new View Controllers in Xcode, if you right click on the folder for where you want to create the class, then click Add New.
You then need to then wire them up to your View Controllers in the storyboard (you will see a drop down which shows the name of the class for the view controller in the properties I think it's the fourth icon from the right, it will be UIViewController). Once you have done this, you will then be able to wire up the controls on it.
Once you've saved it, it will automatically create the C# classes in MonoDevelop when you switch back to MonoDevelop. Don't try and do the class in Mono first as it causes you all sorts of issues!
Hope that helps, if you want more information about storyboards, I've found that the objective c stuff is about as good as you can get for now as there isn't too much support for monotouch storyboarcs yet.
Davoc

Primefaces - using dialogs and layouts

I have a (JSF 2.0/ Primefaces 2.2RC-SNAPSHOT) app that has
<p:layout>
I use a lot of dialog in my application and before the newest version of primefaces came out there was no way to display a dialog with a modal on top of the layout without putting the dialogs outside of the tags.
So I did just that. The issue I am having now is I am noticing that constructors and postcontructs are being called when my application is loaded. This is because the view with the layout is being loaded and therefore all my dialogs are being loaded.
I don't want these constructors being called until I am actually dealing with the appropriate views in my application.
I have been testing the appendToBody attribute on the
<p:dialog>
tag but it seems really buggy. Everything works fine on the initial rendering of a view. I can open a dialog close it etc and it works fine. If I navigate away to another view and then come back to the initial view and open the dialog, everything is running off the page. The dialog window is in the correct place but the content is not.
My question is 1. Is there a way I can have the dialog windows outside of my layout as a child of the
<h:body>
without having all the managed bean constructors associated with them initiated when the application loads?
Or does anyone know how to fix the alignment issue when using the appendToBody tag? Thanks.
When using layout and dialog, I usually place my dialogs outside of the layout as a direct child of the body element. I have a special ui:insert part in my page template for this.
appendToBody was added to make this easier, if it doesn't work well for you, give this approach a try. I know modal dialogs and layout can work this way.
without having all the managed bean constructors associated with them
initiated when the application loads
Maybe the managedbean gets loaded when your dialog is rendered.
Try rendering the dialog only after the button click, perhaps byputting rendered="#{mybean.flagLoadMyDialog}" on the dialog, and set the flagLoadMyDialog when the button is clicked using ajax.
Also remember to ajax-update the dialog after the button click.