Xamarin and MVVMCross - EmployeeDirectory - mvvmcross

Xamarin.Android has a nice little demo called EmployeeDirectory. I am looking forward to implemenmt the PersonActivity in MVVMX. This activity is basically a listview that takes arbitrary data from the VM, and display them in grouped mode.
I have fiddled with the Grouped listview in MVVMx Conference example and got this to work. This is as close as what I am looking for. Would there be any MVVMx example that mimics the EmployeeDirectory PersonActivity page? http://xamarin.com/prebuilt/employeedirectory

If you're looking for samples of ListView, you may want to look at some of the N+1 Videos, specifically Books(N-06 - N-07), Kittens(N-10 - N-11), and CollectABull(N-12 - N-17)
N+1 MvvmCross
https://github.com/MvvmCross/NPlus1DaysOfMvvmCross
MvvmCross Tutorials
https://github.com/MvvmCross/MvvmCross-Tutorials
For example:
https://github.com/MvvmCross/NPlus1DaysOfMvvmCross/blob/master/N-06-Books/Books.Droid/Resources/Layout/FirstView.axml
<Mvx.MvxListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
local:MvxBind="ItemsSource Results"
local:MvxItemTemplate="#layout/item_book"
/>
http://www.youtube.com/watch?v=He6QvnLsPUA

Related

PrimeFaces with lazy loading and custom filterModes

I have problem figuring out how to incorporate filtering such as this: https://www.primefaces.org/showcase/ui/data/datatable/filter.xhtml
(for example that sales status)
into my lazy loaded datatable based on this: https://www.primefaces.org/showcase/ui/data/datatable/lazy.xhtml
The second example is my base (I only created Car according to the attributes and fixed LazySorter's compare and LazyCarDataModel's load so the applications does not crash and does what it should and it works for me same as the the example on primefaces webpage). So the basic filterBy is functional.
I realize that the filtering with Lazy Load is done in load() function but how to call that load with my custom filter? How to add those filtering methods used in FilterView? They use "PF('carsTable').filter()" in my case carTable but it does nothing. How to somehow connect it with my load function?
(I found several similar but not same problems and solutions or and I tried to decode and use them. I did not manage to make it work so far.)
Additional challenge to solve (if someone would be so great to care :D): Separating those filters into my own buttons not embedded into the datatable (like commandLink or commandButtons).
I'll be grateful for any help. If you need to see my code I can provide it but those examples are basically it and its nicely structured and formated.

Which Polymer Datepicker

I don't see an official Polymer Datepicker component. A quick web search yields the following third party components. One of the below thread has some interesting tidbits. Can we expect an official one in the coming weeks?
Polymer Date Picker
this thread hints at a material design date picker
and this thread also shows several date pickers
Calendar Datepicker
Polymer Datetime Picker
Paper Datepicker
Paper Calendar
I've created paper-date-picker (docs / demo) and paper-time-picker (docs / demo) components with the goal to mirror the android versions as closely as possible, while still having decent performance on mobile devices. I opted against infinite scroll for the date picker, as I couldn't seem to find a way to make it work without sacrificing performance.
Please test on your own devices and let me know what you think (pull requests welcomed)!
For Polymer 0.5:
I found this date-picker:
https://github.com/David-Mulder/paper-date-picker
http://david-mulder.github.io/polymer-docs/bower_components/paper-date-picker/
Doesn't use 3rd party libs.
Has good APIs(beside documented ones) as:
refreshScrollPosition, currentYear, currentMonth, currentDay,...
Example: Plunk
Tip:
Polymer, how to pass value to paper-date-picker attribute that expects string?
domReady: function(){
//paper-date-picker expects 'date' attribute to be of type DATE.
this.birthdate_date = new Date(this.birthdate);
},
Edit:
Time-picker links:
http://nemento.github.io/nemento-timepicker/components/nemento-timepicker/
http://component.kitchen/components/virtual-dev/md-timepicker
Also check out https://vaadin.com/elements/-/element/vaadin-date-picker
It has material design inspired styles, so it fits in well with other paper elements. Well documented and apache 2 licensed.

Adding xaml page as Pivot Item

I have two xaml page, PageOne.xaml and PageTwo.xaml. Each xaml has its own code behind PageOne.xaml.cs and PageTwo.xaml.cs running different logic.
Now, I wish to create a Pivot Control, adding two Xaml pages above as Pivot Item in C# code.
How can I do that?
Yes, you can. Simply convert PageOne and PageTwo into UserControls then set the PivotItem.Content to the UserControls.
This related question discuses lazy-loading of the UserControls for performance reasons.
Caliburn Micro, an MVC-like framework for Windows Phone and Windows 8, has a built in helper which automatically handles PivotItems like this.
You can't. A PhoneApplicationPage can be hosted only in a PhoneApplicationFrame. You will need to transfer your two pages layout into the Pivot control, in different PivotItems.

Custom Container ViewController Xamarin / Monotouch Example

Does anyone have a simple C# Example showing how you could use Custom Container ViewControllers with Xamarin / Monotouch as per this Apple documentation -
http://developer.apple.com/library/ios/#featuredarticles/ViewControllerPGforiPhoneOS/CreatingCustomContainerViewControllers/CreatingCustomContainerViewControllers.html
Instead of posting question, thought would be more helpful to go away and create an example.
https://github.com/wickedw/ViewControllerContainer/blob/master/README.md
Readme Excerpt
I got to a point within a project whereby I wanted to display 3 different "Screens" of information based on a user selection.
The TabBarController was not appropriate as the GUI sat within a UINavigationController hierarchy. Yet, the UISegmentedControl fitted the design well.
I already had my views fully coded as seperate ViewControllers (and not all using the same creation pattern, some used Monotouch Dialog, others Nib files, others Programmatic).
Therefore, I did not want to rewrite existing code to use a Single ViewController controlling multiple Views.
I also thought it was time I looked at "Custom ViewController Containers" as they seemed an ideal fit for this scenario.

How can I implement composite Views of composite ViewModels?

I'm just getting into my first project with (the unbelieveably excellent) MVVMCross and I can't figure out how to do something that seems fairly basic: composite views.
Suppose I've got a Person (FirstName, LastName, etc), and a person has an Address (Street, City, PostalCode, etc.). So I'll also have a PersonViewModel and an AddressViewModel.
This is a strictly tablet based app (iPad only, actually) and I want to use containment to have the PersonView contain the (reusable) AddressView, such that the outer (person) view binds to Person, while the inner (address) view binds to Person.Address.
I (dimly) understand the presenter concept for showing the views, as discussed here, but I can't see how to handle the propagation of changes from Person to Address and back.
Suppose the Person object has an Address object, but the PersonViewModel shows the AddressViewModel in an AddressView by passing some sort of Address id and rehydrating. Then the AddressView is binding to a different Address object than the one the Person contains. I don't see how to keep the two in sync, which of course would defeat the whole purpose of binding.
How should I do what I'm trying to do?
This is a really wide topic...
...and there are lots of possible answers.
I think it's important to consider ViewModel's as a very simple concept - I'd like to encourage you to think of ViewModels just as being models for views - definitely don't think of them as 'whole page' objects.
....
Within MvvmCross, you can use ShowViewModel and custom presenters to change the UI if you want to - and this is demonstrated in several MvvmCross examples including the split view presenter - http://slodge.blogspot.com/2013/05/n24-splitviewpresenter-n1-days-of.html
This ShowViewModel technique is really useful for navigation - for changing the whole page or for significant portions of it.
However, you don't have to use navigation paradigms if your app doesn't need them.
If you want to, then you can instead:
build your own hierarchies of viewmodels within the core
and you can then build your own databound hierarchies of views within the UIs
It's entirely up to you - your app is king.
....
I feel like I'm not explaining this very well...
....
So I gave up and recorded this video - maybe it helps: http://slodge.blogspot.co.uk/2013/06/n32-truth-about-viewmodels-starring.html
The video and sample code only covers the iPad, but I hope it's easy(ish) to see how you would extend it to other platforms:
for Windows you can use UserControl
for Android you can use MvxFrameControl, custom view or Fragment code.
There's a plugin that allows Control navigation in addition to the default Views navigation, hope it helps: https://github.com/ChristianRuiz/MvvmCross-ControlsNavigation
Please check out this implementation of a custom presenter for MvvmCross projects. To support Fragments in android and also multiple fragments into one other fragment/activity:
https://github.com/JelleDamen/CustomMvxAndroidPresenter