latest posts

Windows Phone for me is the perfect platform – letting you as a developer focus on your application with an intuitive API and the language many of us have grown to love since its inception, C#. For years going back to Elementary School when games like Doom and Descent were captivating my desire to make my own games, the biggest problem was finding the “perfect” platform to develop for without having to invest considerable ramp up time. Sadly, patience to stick with something even when the going got tough was not one of my strong suits until Middle School when I got proficient with Visual Basic 6. Fast forward to Fall 2010 when Windows Phone 7 came out, being a Day 1 adopter with a Samsung Focus, I took to the SDK almost immediately. At that point, I had done a pretty large iOS application at work so I wanted to see what I could do on a different platform without having to use XCode’s Interface Builder and associated headaches. (I should note it has gotten considerably better since August 2010 when I first started doing MonoTouch development – see my other blog posts for many fixes to a few gotchas). Move ahead a few months to my first Windows Phone game I worked on a few night and weekends in April 2011. This particular game relied on Web Services, realizing then WCF was only supported, I had to teach myself WCF along the way (which later benefited my day job in a huge way over the “classic” .NET Web Services I had been using). Within 2 weekends only having done a few WPF applications in the past I was up and running with a functional game to the envy of co-workers and myself. A few years and a few Windows Phones later; I have nine small Windows Phone 8 applications in the Marketplace with a few more in development with one also having Windows 8 and a HTML 5 port. One of the best things that I found when working with a new platform that I try to convey to other developers: get the foundation down pat; do not get tempted to become the next “copy and paste” coder. It might get you from Point A to Point B faster, but you are going to be lost when it comes time to debugging or if you end up doing it professionally for an employer. Since mid-November, virtually every night and weekend I have spent time reading, practicing and coming up with apps I can focus on a particular new technology whether it is Azure Mobile Services, Microsoft Live integration, “Kindle-like” interfaces or file handling to name a few. I have built up quite a toolbox so when I get an idea for an app, all of the foundation knowledge is well behind me and I can just jump in and focus my time on the “new” features of the app or game. From experience interacting with quite a few developers over the years, I feel we really fall into two groups: the paycheck collectors and those that are in this industry because they like to solve problems and create things from an empty slate. I am grateful to haven found quite a few on Twitter over the last nine months who fall into the latter category – the passionate, dedicated to their craft developers. For me all of the things mentioned above regardless of market share figures – I will continue to develop for Windows Phone as long as possible.
Came into a frustrating issue this morning with an app using MVMM in Windows Phone 7. I had a couple of textboxes, 2 with multi-line support and an Application Bar with a Save Icon. The idea being if you wanted to save your changes in the textboxes, tap the Save Icon and everything would save. Little did I know, the Textboxes only trigger an update to your binding when losing focus. So if the end user left the textbox focused, the trigger wouldn't occur and your save functionality in your View Model would not have the newly entered text. A clean work around for this problem is to create a generic OnTextChanged event handler function to trigger the update and then map that function to each of your textboxes. Here's some sample code in my XAML file:
<telerikPrimitives:RadTextBox TextChanged="Rtb_OnTextChanged" Text="{
    Binding Option.Title, Mode=TwoWay}
" x:Name="rtbTitle" Watermark="enter your title here" Header="cover page title" HideWatermarkOnFocus="True" /> <telerikPrimitives:RadTextBox TextChanged="Rtb_OnTextChanged" TextWrapping="Wrap" Text="{
    Binding Option.CoverPageText, Mode=TwoWay}
" x:Name="rtbCoverPage" Height="200" Watermark="enter your cover page text here" Header="cover page text" HideWatermarkOnFocus="True" /> <telerikPrimitives:RadTextBox TextChanged="Rtb_OnTextChanged" TextWrapping="Wrap" Text="{
    Binding Option.SummaryPageText, Mode=TwoWay}
" x:Name="rtbSummaryPage" Height="200" Watermark="enter your summary page text here" Header="summary page text" HideWatermarkOnFocus="True" /> ]]>
And then in your code behind:
private void Rtb_OnTextChanged(object sender, TextChangedEventArgs e) {
     var bindingExpression = ((TextBox) sender).GetBindingExpression(TextBox.TextProperty); if (bindingExpression != null) {
     bindingExpression.UpdateSource(); }
}
]]>