Monday, June 25, 2012

I wonder... where did the "2 days of developer stuff" disappear from the Windows Phone summit?

Early May:

Early June:

June 20th arrives:
"Welcome to the Windows Phone 8 Platform Preview" - a press conference lasting 2 hours and sharing very limited developer info.

Saturday, June 23, 2012

Thursday, June 14, 2012

MvvmCross on Channel9

My friend Daniel Plaisted at Microsoft has just posted this video on Channel 9 - it includes TwitterSearch from MvvmCross vNext.

In particular he shows the code sharing in MvvmCross across Metro, WP7, MonoTouch and MonoDroid:

Portable libraries are the future - love em!

Changing Navigation Bar Button colour (color) in MonoTouch and MvvmCross

This was my answer:

At the end of this, I was able to add some bar button changes like:
        var leftButton = new UIBarButtonItem("FooBar", UIBarButtonItemStyle.Bordered, null);
        leftButton.TintColor = UIColor.Green;
        NavigationItem.SetLeftBarButtonItem(leftButton, false);
        NavigationItem.RightBarButtonItem.TintColor = UIColor.Red;
Which resulted in:
Alternatively, by placing code in the WelcomeView:
        var leftButton = new UIBarButtonItem("FooBar", UIBarButtonItemStyle.Bordered, null);
        leftButton.TintColor = UIColor.Green;
        NavigationItem.BackBarButton = leftButton;
Then I succeed in achieving:
Alternatively, by using code like:
        UIBarButtonItem.AppearanceWhenContainedIn(typeof(UINavigationBar)).TintColor = UIColor.Blue;
Then this enabled me to customise all the navigation bar buttons like:

At one point, I also managed to achieve:
... but sadly I've genuinely no idea which code combo gave me that! If your problem is with back buttons in particular, then I think you will need to dig around other questions and/or post some code and hope someone can help - there's lots of posts about how to do this, but I can't quite figure out what they all mean for MonoTouch - e.g. Separate title in NavigationBar and navigation buttons

Thursday, June 07, 2012

How to bind to a UIViewController instance Property in Monotouch MvvmCross


From reading your question, I think what you are saying is that the View itself has a field of type string...
Your code:
     new Dictionary()
          { StringTemp, "{'Text':{'Path':'AboutText'}}" },
is trying to bind the property Text on the object referred to by StringTemp to whatever is inAboutText on the ViewModel.

To set the StringTemp string itself you should be able to bind to it using something like:
      new Dictionary()
           { this, "{'StringTemp':{'Path':'AboutText'}}" },

Just to explain the parts in: { this, "{'StringTemp':{'Path':'AboutText'}}" }, these can be thought of as { TargetObject, "{'TargetPropertyName':{'Path':'SourcePropertyName'}}" } where:
  • TargetObject (this) is the object you are aiming to set property values on
  • TargetPropertyName (StringTemp) is the name property that you are aiming to set
  • SourcePropertyName (AboutText) is the name of the property that will be the source of the value
Note that Mvx uses Properties - not fields - so private string StringTemp {get;set;} is bindable, but private string StringTemp; is not.

You could also do two-way binding for this string reference if you wanted to... but you would need to setup some custom binding information to do so - there would need to be some event fired and captured in order to update the ViewModel (I'll leave that for another day!)

For situations where direct binding isn't what you are looking for, then you can always subscribe to PropertyChanged and handle the notifications in more verbose code... e.g.:
ViewModel.PropertyChanged += (s,e) => 
    if (e.PropertyName == "AboutText")
         // do something complicated here with the new ViewModel.AboutText value
...but I personally tend to avoid this type of code where I can...

Saturday, June 02, 2012

Mvvm - MvvmCross - MonoDroid, MonoTouch, Wp7 and WinRT - going portable

A presentation in progress about the changes for using Portable Class Libraries (and Portable Library Projects) within MvvmCross for MonoDroid, MonoTouch and WP7

On SpeakerDeck:

On SlideShare: