Jaime Rodriguez
On Windows Store apps, Windows Phone, HTML and XAML

  • Jaime Rodriguez

    UpdateSourceTrigger on Windows Phone data bindings

    • 5 Comments


    I am writing this tiny demo app, that has a TextBox data bound to a ViewModel. 
    I want the TextBox to fire notifications to the ViewModel whenever the text changes (as opposed to only firing notifications when the textbox loses focus).
    In WPF, this is trivial to do, you just set the UpdateSourceTrigger on the Binding to PropertyChanged  (in fact, I think that is the default).
    On the phone, I only see UpdateSourceTrigger supporting:

    • Default (which for TextBox appears to be LostFocus ) and
    • Explicit.  Which is just telling me to man-up and do it on my own logic.
      No option for PropertyChanged.

    What to do? 
    [12/5  (Update part 1) -- Updating this post due to enough feedback that the semantic of TextChanged is better than my post’s KeyUp.
    I did try that before suggesting KeyUp on my original post but I was seeing TextChanged fire more often than KeyUp (aka more times than I felt necessary).
    Now that I have seen there is no big perf hit (since others are doing it with TextChanged) I am back to proper semantics.
    Also you made me second guess and I tested on a keyboard and noticed that arrows can even the score firing KeyUp events. 

    How about:

    1. Setting the UpdateSourceTrigger to Explicit 
    2. Listening to TextBox TextChanged event, then firing the explicit update?

    Here are the snippets:
    In my XAML,

       1: <TextBox x:Name="empIdTextBox" Text="{Binding Id, Mode=TwoWay, UpdateSourceTrigger=Explicit}"                    
       2:             TextChanged="empIdTextBox_TextChanged"/>
    code-behind,

       1: private void empIdTextBox_TextChanged(object sender, TextChangedEventArgs e)
       2:     {     
       3:       TextBox box = (TextBox)sender;
       4:       BindingExpression be = box.GetBindingExpression(TextBox.TextProperty);
       5:       be.UpdateSource();
       6:  
       7:     }

     

     
    [12/5 Update part 2]
    Corrado Cavalli and Curt Nicholas emphasize that I should use Behaviors.  
    My sample was part of the intro to data binding chapter in Learning Windows Phone, so I did not want to go to behaviors (yet). Still, for production apps, here is the behavior.
    Curt also mentions I can cache the BindingExpression.  I tested it and seems to work, but I was not sure when (or if) binding expression gets invalidated so I leave it for you to complete the research for your scenario.
       1: public class UpdateSourceOnTextChangedBehavior : Behavior<TextBox>
       2:   {
       3:  
       4:     protected override void OnAttached()
       5:     {
       6:       base.OnAttached();
       7:       this.AssociatedObject.TextChanged += this.OnTextChanged;
       8:     }
       9:  
      10:     private void OnTextChanged(object sender, TextChangedEventArgs e)
      11:     {
      12:       BindingExpression be =
      13:         this.AssociatedObject.GetBindingExpression(TextBox.TextProperty);
      14:       be.UpdateSource(); 
      15:     }
      16:  
      17:     protected override void OnDetaching()
      18:     {
      19:       base.OnDetaching();
      20:       this.AssociatedObject.TextChanged -= this.OnTextChanged;
      21:     }
      22:   }
       1: <TextBox x:Name="empIdTextBox" Grid.Column="1"                 
       2:                 Text="{Binding Id, Mode=TwoWay,UpdateSourceTrigger=Explicit}" > 
       3:          <interactivity:Interaction.Behaviors>
       4:            <local:UpdateSourceOnTextChangedBehavior />                             
       5:          </interactivity:Interaction.Behaviors>          
       6:        </TextBox>         
    Happy Windows Phone coding!
  • Jaime Rodriguez

    Windows Phone Application Performance at Silverlight Firestarter

    • 0 Comments

    Yesterday I did a dry-run of my performance talk for today’s Silverlight fire starter.

    Conclusion was that the talk is like drinking from a fire-hose. It is tight for 45 minutes, but the content is good and we could not agree on what to cut. It was all too good and useful to cut stuff.  

    So,  I am going to cheat Smile  and give you an early preview and a guide to make it easy to follow along.

    • Here is the deck (might get a few edits between now and 4:30 PM)
    • Here is a cheat-sheet. It is in draft mode. It is incomplete, but if you are a beginner, it should help get you through my 86 mph talk. I  will be updating it and completing it as we go in next few days.  Expect an update over the weekend ( booked tomorrow and hopefully partying with firestarter folks tonight).  Full disclaimer, this is a stream of consciousness draft, very rough, not even spell checked (just realized the latter, but have already published in sky drive).
    • Here is the sample code.

     

    Join me today at 4:30 PST. Live at Silverlight fire starter
    if you can’t make it, check later for final document, including a part 2 and the video recording.

    Happy Windows Phone coding!

  • Jaime Rodriguez

    ISO image for the Windows Phone developer tools..

    • 0 Comments


    For those of us who have multiple machines or re-install often and don’t like to download every time using the web installer,  there is an ISO image for the Windows Phone Developer tools

    Download using this link.. http://go.microsoft.com/fwlink/?LinkId=201927.

    This is the RTM version ( so what we released around 9/15).   Don’t forget to install the October update for the tools after you have installed the tools from this iso.

    Also, if you are a VB developer, you will have to get the VB tools support  that RTMed yesterday  

    Happy Windows Phone coding!

  • Jaime Rodriguez

    Working with GIF images in Windows Phone

    • 0 Comments

    As you know, Silverlight does not have native support for decoding gif images. That is downer, but not a showstopper since several 3rd party, opensource libraries for decoding Gifs. GifCompare

    The Twitter for Windows Phone team used the ImageTools project from Codeplex to decode gifs.   It worked well, but when we implemented there were two things that bothered me a little:

    1. The decoder was not perfect.  In our experience, it does ~90% of the images we tested  [and that was thousands of images, so representative test]
    2. There was one infinite loop that bothered me.  Has to do with nextflag during decoding. The Decoder checks for flags to be != 0, and for some odd reason we have seen gifs with nextFlag = –1; this can send your app into an infinite loop.

    I knew there were other libraries and partners were using these (for example,  the GifDecoder library shared a long while ago by Joe Stegman).
     
    Today, I finally compared these two libs side-by-side.  I used ~400 images.  25% came from a list of Gifs that had known issues. The other 75% was a random selection by looking at a Twitter user, and downloading his followers and filtering for the ones that used gifs.

    The results:  
    Decoding wise, these two libraries are pretty much the same code.  I should have started by comparing that before I wrote my test.  Instead, I found it by accident as I dived in to fix the infinite loop above.
    The results are pretty inline with our original ~90% assessment.  My tests are a bit lower but again it is because I spiked the test.

    The codeplex library is getting updated a lot more, and is growing and getting fixes, so that is what I am sticking with for my projects.
    They have done a lot of work on their AnimatedImage control (which supports animated gifs, looks pretty neat (though I have to say animated gifs feels like going back in time).

    If you need to decode Gifs, I do recommend you use this library. It is better than nothing.   Please do make sure you:

    1. Download the latest from codeplex. It is getting updated often.
    2. Test it for infinite loops.  You can download the source for my comparison app. I am attaching it to this post.  Or you can just check the source for the library.  The current issue is at ImageTools.IO.Gif.GifDecoder.Decode ()  their loop checks for  while nextFlag != 0 ….   and I simply tweaked it to  while nextFlag > 0 …    I have no idea what my changed does to GIF decoding since I know nothing about the format, but I know that I can get  ~90% of my Gifs to decode and I don’t have the infinite loop, so it works for me..

    I am sure the library will improve over time,  I pinged the folks with my tests and my results in case it helps improve. 
    Source for my little test, and source for the libraries I used (with small changes) are in skydrive

    Happy Windows Phone coding!

  • Jaime Rodriguez

    Windows phones hardware reviews

    • 1 Comments


    Kevan Hutson (or some one in his team) created this great ‘aggregation’ of reviews of different Windows Phone models.
    It is a bit US-centric, because it aimed at helping the MS-based US Employees order their phones now that Windows Phone is launched in the US.
    Still think it might be useful to many of the people reading this blog.. and if not, it can influence others to share better links, or even their own reviews..
    So, with Kevan’s permission, sharing his internal list.  

    Take it with three grains of salt; I did not read all the reviews, this is very unofficial, and I am sure not comprehensive.. Still, it did help me, so I thought was worth sharing..

    Samsung Focus | AT&T

     Brilliant 4” Super AMOLED Screen  
    Thinnest, lightest Windows Phone
    Audience Noise Reduction

    Consumer Reports: Samsung Focus is sharp, with a few dull spots
    The Samsung Focus looks like a winning smart phone, thanks to its gorgeous display and the efficient and attractive operating system behind it.

    Gizmodo: The first Windows phone that matters
    [Samsung Focus is] the thinnest and lightest Windows Phone, and its Super AMOLED display is the best screen too. If you're going to get a Windows Phone, this is the one to stare at the hardest.

    PCMag.com
    The Samsung Focus plays up Windows Phone 7's strengths and plays down its weaknesses for a great Windows Phone experience.

    Engadget
    The Focus is kind of the everyman of the Windows Phone 7 line. It doesn't really have any fancy features and isn't especially stylish... but it gets the job done.

    MobileBurn: Windows Phone 7 and great hardware
    The build quality on the Focus is amazing. It is a very solid and rich-feeling device. That it is good looking and features the best looking display on the market, in my opinion, certainly doesn't hurt.

     

     

    LG Quantum | AT&T

    Full QWERTY Keyboard
    16 GB Internal Memory
    Play To (DLNA) Support

    Engadget: LG Quantum first hands-on!
    We're very torn on the LG Quantum. From the outside you've got a design that can only be named as "frumpy," with wasteful curves and rubberized edges, along with the smallest screen of the AT&T bunch. Still, slide this puppy open and you're treated with one of the best QWERTY keyboards in the business.

    ZDNet
    The Quantum takes a stand as it is the only Windows Phone 7-based device with a slide-out full QWERTY keyboard.

    PCMag
    The LG Quantum could be a quantum of trouble. The first Windows Phone 7 device with a full keyboard that will be sold through U.S. carrier stores, it has a balky sliding mechanism and a really bizarre keyboard layout that could kill its appeal.

     

    HTC Surround | AT&T

    Slide-out speakers w/ kickstand
    SRS Dolby Mobile Surround Sound
    16 GB internal memory

    MobileTechReview.com
    It's business as usual for HTC: attractive and understated finishes that avoid looking plasticky, a solid feel in the hand and considerable heft thanks to the slider design.

    PCMag.com
    The HTC Surround promises a big entertainment experience with its kickstand and huge slide-out speaker, but Windows Phone 7 just isn't up to the task.

    Engadget
    The Surround needed to bring a lot to the table in order to justify being bigger and heavier than the Samsung Focus while lacking the QWERTY keyboard of the LG Quantum, and we just don't think a pair of average speakers and a kickstand provides that justification

    Gear Live
    The HTC Surround is a good phone, and its the one we'd recommend if watching movies and listening to music is your jam.

     

    HTC HD7 | T-Mobile

    Largest 4.3” Screen
    T-Mobile TV built-in

    CNET
    The hardware could use a bit of updating, but the HTC HD7 for T-Mobile combines the power of Windows Phone 7 with a large touch screen and delivers satisfying performance.

    PCMag.com
    The T-Mobile HD7 is a good-looking phone that's a fine canvas for Windows Phone's services, but it's not at the top of its class.

    Gizmodo
    Overall, the HD7 is not a bad phone, and it's a perfect serviceable vehicle for Windows Phone 7. It's just not a great phone.

    Boy Genius Report
    The Windows Phone 7 OS on HTC’s HD7 is absolutely fantastic in many respects, and yet in other areas, it is an OS filled with almosts.

    Engadget
    The reason we like the HD7 is that it seems to be just about the perfect size for us. It trades little in the way of added bulk for an awful lot in added real estate and general usability.

    SlashGear
    The HD7′s large display, responsive interface and our generally positive feelings about Windows Phone 7 all stand in its favor, but there are still niggling flaws and frustrations that mar the overall experience.

     

    Dell Venue Pro | T-Mobile

    Vertical QWERTY Keyboard
    Scratch & Shatter Resistant Screen
    Available on T-Mobile, sold through Dell

    Engadget: Dell Venue Pro (aka Lightning) first hands-on!
    No matter what you call Dell's Windows Phone 7 portrait slider, it's downright awesome.

    CNET
    The smartphone feels very solid in the hand. In addition to the slide-out QWERTY keyboard, the Venue Pro also offers a 4.1-inch WVGA AMOLED touch screen, which was both sharp and responsive in our brief hands-on time with the device.

    Gizmodo
    The Venue Pro has a bit more heft than some of the other WP7 devices launching today, but it's not overly bulky. It just feels solid, durable.

    PCMag.com:  Windows Phone 7's dark horse? Hands on
    I want to love the Dell Venue Pro. This is the Windows Phone 7 with a keyboard that might actually work. But it's from Dell, and even T-Mobile doesn't seem to have complete faith in the phone.


    Additional reviews worth reading:
    CNET - First impressions: HTC HD7, Dell Venue Pro
    Engadget - Windows Phone 7 in review: the good, the bad, and the Surround
    InformationWeek - Review: AT&T's Windows Phone 7 handsets tested
    Maximum PC - Windows Phone 7 impressions: The first 24 hours
    PhysOrg - Review: Microsoft hits refresh on smartphones
    ZDNet - Hands-on with the HTC Surround and Samsung Focus WP7 smartphones


    Additional Model Reviews - EU and APAC
    LG Optimus 7 E900 review (Stuff Magazine)
    Samsung Omni Review (Telegraph)
    Trophy (TechRadar)
    Mozart (Pocketlint)

  • Jaime Rodriguez

    The Windows Phone platform and Windows Phone devs are both doing great

    • 4 Comments


    Yesterday, I saw a few posts, tweets and personal emails from smart, professional developers  who are building great windows phone apps and did not appreciate getting caught in the recent slew of press and marketing exchange around Windows Phone perf.   I am going to share my personal experiences to try to clarify the likely misinterpretation..

    The problem/story:
    Press goes to marketing (not engineering folks) and tells them “when are you going to fix the perf problems in the platform, we are seeing a few apps lag?” … 
    Windows Phone marketing answers it the way they see it “there is no problem with the platform, we are working on education for developers to improve their apps”..
    Some developers then get upset and respond with a “what are you talking about? We know our stuff, our apps are good, some are even great, we just need you to improve <insert a feature or a hardware component here> so it is faster..” ..

    At first glance, the stories are in partial conflict.. and the developers get caught in the middle (since they are not in the conversation that is getting reported), so I have to share my personal experience as a developer collaborating with partners and developers  to build build good and great Windows phone apps(disclaimer, I still work for Microsoft so I am biased, and all that, but I also like to tell it like it is so read on and decide).

    Answer or state of the union:
    Every platform always needs performance improvement. Users will always demand more.  Engineers will always aim to provide more. I know our Windows Phone engineering team has improvements and fixes coming into the platform to make things better/faster…

    At the same time, the journalist question around “fixing the performance in the platform” is a loaded question and implies “it is broken”. 
    Every platform has small bugs and short-falls so the question is whether this is a systemic problem or a big hole that really qualifies ours as “broken”.  I can’t speak for every developer but my experience has been that there is a very reasonable (low) number of bugs as expected, and the platform works and performs well with-in user expectations, so I can understand why MS marketing folks are  responding with the “it is not broken, we just need to advise developers to get the most out of their apps”.

    So, why do they say that?  I won't speak for all developers, but I can share that  100% of the apps I have been involved with, can use performance improvements that developers can make today but simply need more time to implement or did not understand a month ago; these are new apps, new usage patterns, etc.. There is also changes that will (eventually) come for free to the platform as improvements (you can call them bug fixes if you want but I would call them optimizations) that will make existing apps better (with out neding changes).

    On my partner’s projects, we had to balance between features, optimizations, and polish within the constraints we had to get us to launch – biggest constraint being time,  beta of the platform was shipped ~3 months from RTM, most apps were built in this time-frame.   As developers and engineers, we discover new characteristics or niche scenarios in the platform every day. We are are thriving with all these great new lessons or lessons that others are sharing, and we are improving the apps, lots of these apps are already released their first or second update, and I am sure every one of these is better than their previous release.   

    That is why Microsoft is emphasizing education and broad sharing. It is not blame, it is just a natural partnership for any brand new platform ..

    To the developers:

    When you hear MS marketing folks say “we are working to train and educate developers to improver performance on their apps” please don’t misinterpret as an insult or blame . What Microsoft folks are trying to say is “we have a great platform, but the hardware has been available only for a short time, the new amazing experiences we are seeing every day have never been built before on any platform.  We know we have a strong foundation, but we learn new stuff every day,  and we want to share it as guidance and education so you (developers) can leverage the tips can make your apps even better. 

    In my opinion, there is a lot to be proud of..   There is some amazing apps, and some great reviews.  The fact that reviewers like Gizmodo are comparing the Windows Phone apps to apps that have been in other platforms for 18 months to 3 years, and we are comparing neutrally or favorably is pretty amazing.   It has been ~8 months since developers even heard of our platform.  It has been only four months since beta and only a few weeks of marketplace being open.  What do we have to show for?  Thousands of apps in the marketplace, tens of thousands of developers registered,  over half a million downloads of the tools..   All-up, this is a great story…  The read I get from peers at Microsoft is that we are very proud of the platform and the tools,  and we are very impressed (often amazed) with some of the the apps that are getting in the marketplace.  We are heavily invested in providing the best tools and the best guidance.  When we say  we are working on education, all that means is we are ready to partner with you  (our developers).  Your success is the pillar to our own platform’s success. Long-term, we will optimize the platform even further , and half of the issues that are annoying us today will be gone,  but interim, we will have to work together to create great apps.   We know the platform can do it since plenty of you devs already proved it.. 

    Let’s keep rocking and don’t over analyze sensationalist titles to news stories..
    That is my personal 2c.  Back to my writing some good tips on my upcoming Windows Phone book Winking smile ..

  • Jaime Rodriguez

    GeoCoordinateWatcher tips part1

    • 0 Comments

    A few tips for those using GeoCoordinateWatcher in Windows Phone 7.

    The data:

    • GeoCoordinateWatcher events fire in the UI thread.  Yes, StatusChanged and PositionChanged fire in the UI thread. 
      This is not due to thread affinity or any thing similar. Even if I start the GeoCoordinateWatcher in a background thread, it still fires events in the UI thread. They wanted to make it easy for developers.
       
    • GeoCoordinateWatcher PositionChanged will fire as often every second if you do not give it a MovementThreshold. Yes, you can not move at all and it is firing (on your UI thread).  Note, that is what I see on my phone, I do know the phone is optimized for battery life, so maybe it throttles with battery .. but when fully charged I see a ~1 Hz rate.
    • Getting a GPS fix out of GeoCoordinateWatcher can some times take a second or two. GPS is never a trivial operation (if you have ever turned it on in your car, I am sure you would know).  This can be a pain if you have an app that needs a fix in milliseconds, for example, if you are in search, and you want to do a local search, you want it to have location immediately, you don’t want to wait a second …

    The Tips:

    • Avoid doing a lot of work on the GeoCoordinate events.  They are in the UI thread. Avoid as much work as you can (send to background thread if needed).
    • Absolutely set a MovementThreshold on the GeoCoordinateWatcher   20 meters is probably lowest you should you.  I most often use 250m. Most of the services I use ( twitter, facebook, search, etc.  are doing searches in a > mile radius, 250m is great threshold for these services)…
      • if you do set MovementThreshold you should know that GeoCoordinateWatcher fires event in a weird order and the order can get you when you use MovementThreshold.
      • GeoCoordinateWatcher has a StatusChanged,  which you would expect fires when the GCW is ready…   my experience is that when subscribing to GCW I see this sequence
        • StatusChanged to Initializin
        • PositionChanged   -- with a valid location
        • StatusChanged to ready
        • If you have a high threshold, PositionChanged might not fire again…  so if you were a cautious developer and checked that Status is ready before accepting the location, you might not get a PositionChanged.   
      • The answer (from the devs) is that it is fair to assume that if PositionChanged fires, the status is ready.  It is OK to not check status in this event.
    • If  you read above, when there is no threshold it fires every second…  I am told the threshold does affect sampling rate (we are preserving battery as much as we can) but I am also thinking they are doing work sampling more often than most of my apps need.. I am not writing some thing that requires a position every few seconds..  so what I do for most of my apps is Start () and Stop () the GCW every 2 minutes (or longer pending on the app)…   Start and Stop is not an expensive operation…    Just have your GCW be wrapped by a singleton, and start it and stop it often..  Avoid calling Dispose () on GCW..   I have very seldomly (when stress testing) seen a race condition on Dispose () that could crash my app…   again, happens seldomly but I still don’t like the chances, since it is a singleton, and you can start and stop.. I don’t see a need to Dispose ()..

    That should be all you need to really optimize your location-aware apps… Don’t forget to prompt the user before you use their location ..  
    Feel free to beat me to the next part… you should know what that is..

    Happy Windows Phone coding !!

  • Jaime Rodriguez

    Slides and demos from TechEd sessions..

    • 0 Comments

     

    I have uploaded my slides and demos from my teched sessions.  alt
    Thanks for attending and staying awake Smile 

     

    Happy Windows Phone coding!

  • Jaime Rodriguez

    XAPAthons at Teched Europe 2010

    • 0 Comments


    On my way to TechEd Europe today, and just found out there is a room available to host a Windows Phone XAPathon..
    There was also room for T-shirts for first 12 XAPathon RSVPs.   If you are at the event. Below is the likely places you will find me..
    Tshirt

    XAPAthons

    What is a XAPathon?
    A casual short ( less than an hour unless schedule allows for more) meeting with a so-named Windows Phone expert (in this case me and/or Oren Nachman, a perf expert).
    You can do anything you want with the time:

    • We will have phones, some tools, and eagerness to help you with your app.
    • You can join us for an hour and ask questions, chat, or just borrow a phone and see how your app performs on it.
    • If you are an expert and have already coded an app, you can still join and shoot a brief 15 minute video about your app and your experiences hacking on WIndows phone.  I can then put it as part of my “Windows

    How do I sign-up for a XAPathon ?
    Email me via the link on this blog post.. or contact me via twitter @jaimerodriguez  or Just stop by at the Passau 4 room  (yes, you have to be a registered attendee, sorry).


    Break out sessions

    Monday:
    09:00 Windows Phone Pre-Conference
      ( a ~5 hour dive into building WIndows Phone apps..
    Taught by yours truly.  
    Still working on the timings for the session but slides and decks are done. It will flow like this:

    1. Intro to phone (goals, design, hardware audience)   - Intro
    2. Phone UX – pragmatic
    1. Metro – intro
    2. Interactions – pragmatic
    3. Includes deepdive into phone controls – pragmatic
    • Integrating w/ hardware – pragmatic
    1. Accelerometer, location, mic,  etc.
    2. Keyboard,
    3. Touch
    4. Choosers and launchers
    • Navigation – deepdive
    • tomb stoning – deepdive
    • Push notification – deepdive
    • Lessons learned from a few apps – deepdive
    1. Data
    2. Perf
    3. Other ..

    [intro == 15 mins or less, and it is 200 level] ,
    [pragmatic == 200 to 300 level intro+good practices]
    [deep dive == all you will ever have to know about it]

    Tuesday:

    10:30 WPH101 - Changing our Game : Windows Phone 7 and the Windows Phone 7 Application Platform
    12:00 WPH202 - User Experience Best Practices for Building Applications on Windows Phone 7
    16:30 WPH305 - Understanding the Windows Phone 7 Development Tools

    Wednesday:

    9:00 WPH306 - Silverlight for Windows Phone 7
    12:00 WPH307 - Building Windows Phone Games with Microsoft XNA and Visual Studio 2010
    16:00 WPH309 - Developing Windows Phone 7 Web Applications with WebMatrix

    Thursday:

    09:00 WPH310 - Giving your Windows Phone XNA Games Plenty of Whizz and Bang
    12:00 -WPH311 - Microsoft Silverlight Performance on Windows Phone
    16:30 -WPH214 - Understanding Marketplace and Making Money with Windows Phone 7 Applications
    18:00 WPH315 - Developing for Windows Phone 7 - End to End

    Friday:

    09:00 WPH316 - Building Offline Experiences for Windows Phones and Other Devices using Sync Framework
    10:30 WPH117-IS - Come and Meet the Windows Phone 7 Team
    12:30 WPH318 - Developing Code for Windows Mobile and Windows Phone 7


    Silverlight Focus groups

    At TechEd Europe, the Microsoft Silverlight team will be conducting several focus groups (60-90 min) on-site November 11th, and the purpose is to solicit opinions about Rich Internet Applications (RIA) platforms. The team would love to learn more about your thought process when evaluating these technologies and about your experiences building applications with various solutions!

    All focus group participants will be given a gratuity (Microsoft software) for their contribution.

    To participate, please enter the URL below into your Web browser and fill out a brief form with your name, contact information, and your level familiarity with various RIA platforms, http://www.surveymonkey.com/s/GKG3RN6

    Note: We will only use this information to schedule some time to talk with you while you are at the show, and will not add you to a mailing list or share your information with third parties.

     
    Hope to c u there.. 
    Happy WIndows Phone coding..

  • Jaime Rodriguez

    Guessing if the SIP is visible in a Windows Phone application

    • 1 Comments

    For Silverlight applications, Windows Phone does a good job at abstracting the keyboard from the platform. 
    As a developer, you drop a TextBox any where in your app and whenever the textbox gets focus:

    • The platform will launch the SIP if the hardware keyboard is not available.  When the SIP comes up,  the platform also applies a TranslateTransform to the RootFrame of the application, so that the SIP takes its space, but the textbox is still visible. 
    • The platform does nothing if the hardware keyboard is available. SIP does not come up, does not get on the way, etc.

    Again, all of the above comes for free, and is pretty convenient most of the time.   Unfortunately, every now and then, you do run into a scene that maybe has a button underneath the textbox ( for example, a login window or a  sign-up window with a button near the bottom).   If you are in one of these situations,  the news are not so great. There are no platform events or classes to tell you if a SIP is available and/or when it is shown or hidden.    There is a “hack” that works most of the time:

    When SIP is visible, and the screen has been translated,  the transform is applied at the App.RootFrame (which is a PhoneApplicationFrame).   The easiest way to get notified when this Transform changes (to avoid polling) is to data bind to it; using a DependencyProperty, you get free notifications when the property changes (which of course would happen if the SIP is visible. 
    Here is a sample snippet, that sets an IsChecked property in a checkbox whenever we think the SIP is visible.

       1: public partial class MainPage : PhoneApplicationPage
       2:    {
       3:        // Constructor
       4:        public MainPage()
       5:        {
       6:            InitializeComponent();
       7:            BeginListenForSIPChanged(); 
       8:            
       9:        }
      10:  
      11:        private void BeginListenForSIPChanged()
      12:        {
      13:            PhoneApplicationFrame frame = (App.Current as App).RootFrame;
      14:            Binding b = new Binding("Y");
      15:            b.Source = (frame.RenderTransform as TransformGroup).Children[0] as TranslateTransform;
      16:            SetBinding(RootFrameTransformProperty, b);
      17:        }
      18:  
      19:  
      20:        public static readonly DependencyProperty RootFrameTransformProperty = DependencyProperty.Register(
      21:          "RootFrameTransform",
      22:          typeof(double),
      23:          typeof(MainPage),
      24:          new PropertyMetadata(OnRootFrameTransformChanged));
      25:  
      26:        static void OnRootFrameTransformChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
      27:        {
      28:            double newvalue = (double) e.NewValue;
      29:            MainPage page = source as MainPage;  
      30:            if ( newvalue < 0.0 )
      31:            {
      32:                page.IsSipVisibleGuess.IsChecked = true; 
      33:            }
      34:            else if ( newvalue == 0.0 )
      35:            {
      36:                page.IsSipVisibleGuess.IsChecked = false ; 
      37:            } 
      38:  
      39: #if DEBUG 
      40:            else 
      41:                System.Diagnostics.Debug.Assert ( false, "I assumed this would never happen, let me know if it does"); 
      42: #endif 
      43:             
      44:        }
      45:     
      46:    }


    Full disclaimer, this post begins with guessing. it is not 100% fail-safe.
    The scenario where it fails is when you set focus on a textbox and SIP comes up, and then you open the hardware keyboard on the phone. The platform does not always apply the transform immediately.  The snippet is still right, since the transform has not been removed, but it is annoying that hardware keyboard is readily working and transform is still there.

    The snippet also does not tell you if the SIP is visible when the TextBox is so high enough on the scene that the rootframe does not get translated at all.

    I would recommend you avoid using the trick when you can,  the easiest way to avoid it is not to put buttons that can be covered by the SIP (so no buttons underneath the textbox). . Put the buttons either above the textbox, or on the ApplicationBar. The latter being my preferred approach.

    If you want to try it, the source is here.

    Happy Windows Phone coding.

  • Jaime Rodriguez

    Tips for debugging WP7 media apps with WPConnect

    • 0 Comments

    Monday’s blog post on  running under screen lock generated a couple of questions around media not playing when medialibrary is locked ( and Zune locking Media Library).
    So, today, I remind you about a recently announced tool that shipped with the Windows Phone Developer Tools October Update.

    The tool is called Windows Phone Connect Tool ( internally we know it as either WPDTConnect, or WPConnect, the latter is the final name of the exe as it made it out externally).
    Full instructions on running and troubleshooting WPConnect are here.   My personalized version is below.

    Requirements:

    • Of course, this requires you have the WIndows Phone Developer Tools installed (dah!) . Get the tools from here
    • This also requires you have a version of Zune capable of connecting to Windows Phone. That is version 4.7.1404.  Get it from here
      You will not be running Zune during the debugging, but WPConnect is still using some of that infrastructure that Zune installs.
    • At last, you need to install the WPDT October Update.  Get it from here.


    To run WPConnect:
    You simply need to run the WPConnect.exe. 
    By default it will be installed at  %ProgramFiles%\Microsoft SDKs\Windows Phone\v7.0\Tools\ or at %ProgramFiles(x86)%\Microsoft SDKs\Windows Phone\v7.0\Tools\WPConnect.
    The instructions on MSDN talk about opening a command prompt and navigating to that directory; that is Microsoft internal instructions. For the rest of the world that does not use DOS and command prompt as much as we do inside , you can do any of these and it will work equally well.

      • Run WPConnect from a short-cut on your desktop. 
      • Copy the WPConnect executable some where in your path or your desktop or what ever and run it.

    The really important stuff is to:

    1. Do connect once with Zune before running WPConnect. As I mentioned, the infrastructure is shared.
    2. Make sure you stop Zune before you run WPConnect.
    3. Run WPConnect [any way you want, command prompt not required]

    The results:
    What you  will get is ability to debug applications that play Media on the phone without media library getting locked. You can also debug applications that interact with MediaLibrary.

    A couple of FAQs and or known issues:

    • The update to the tools is an MSP. It is pretty silent. Run it and as long as you do not get an error you will be fine. If you need to test if it succeeded, check for WPConnect.
    • There is no significant advantage or disadvantage between debugging using WPConnect and/or Zune. One is not faster than the other or any thing like that. It is same communication services underneath.
    • WPConnect runs for a few seconds and then exits.  This is expected, don’t be looking for it in taskmgr. If you launch it and it says it connected, you will be able to debug for hours without having to relaunch it. It is like a silent ninja, you don’t see it but it is there ready to strike.
    • Launching Zune any time after WPConnect is running will disconnect WPConnect. This most often happens if you disconnect your phone and connect it again.  The workaround is to close Zune and WPConnect again. 

    That should be all you need.  Read the full instructions for more troubleshooting tips. Hope that helps.

    Happy Windows Phone coding!

  • Jaime Rodriguez

    Hail to the swiss army knife of Silverlight Windows Phone Apps LongListSelector

    • 2 Comments


    Today,  David Anson announced the second release of the Silverlight for Windows Phone  toolkit.   

    This release doubles the number of controls in the kit, includes page transitions, ListPicker, and the new Swiss Army style control for Windows Phone: LongListSelector..
    I am still getting deep into LongListSelector and trying to fit into some apps, but the potential for it is so great, I am doing a preview post on it..

    LongListSelector started as a list that would address the requirements for lists similar to the people hub list.. 
    Headers and Footers that scrolls with the items in the list (see how the “new releases” header scrolls with the list items, this is great for panoramas )

    , WP7_1 (62)                      WP7_1 (63)WP7_1 (65)

    It then morphed into grouping ( similar to Quick Jump Grid control )  

    WP7_1 (67)

    WP7_1 (66)

     

     

     

     

     

     

     

     

    And finally but still equally important as a very performant listbox where you have a lot of control on how items are virtualized, how fast the list scrolls, how big your bounces are, etc.
    LongListSelector  uses a different scrolling mechanism ( animation on render thread ) and different virtualization strategy ( not a VirtualizingStackPanel) that results in better, smoother scrolling in most ListBoxes…

    image

    What are you waiting for???  Go download the toolkit from codeplex

    Happy Windows Phone Coding!

    PS --- Test thoroughly.. With this high degree of customization and so many features into a single control, it is not too hard to make a mistake..  Make sure as you replace your standard listboxes with LongListSelector, you tune the knobs so it works just right for your app..

  • Jaime Rodriguez

    Running a Windows Phone Application under the lock screen

    • 0 Comments


    Last week, Microsoft published new Application content policies for Windows Phone 7 Apps.  One of the changes that got attention was the ability to run applications under a locked screen.  Refer to section 6.3 of the application certification requirements.

    In reality, the change is pretty minor, the capability to run under lock screen has been there since RTM.  Microsoft simply published some new ‘guidance’ on the expectations for applications that run under a locked screen.  That said, the change was interpreted as Microsoft relaxing the guidelines, since now it is clear that running under locked screen is not going to be frowned upon as long as you meet the requirements.  

    Why run under a locked screen? What are the benefits?
    Many applications are expected to run under a locked screen:  music players, run-tracking applications,  map applications, etc.  These applications will likely not change, as the certification guidelines had already approved these scenarios.  

    The changes to the certification requirements are aimed at apps that want to avoid tombstoning. For applications that are slow to recover from tombstoning ( maybe they make network calls and download a lot of data at start-up), they now can avoid the overhead of recovering from tombstoning when the application goes under locked screen.  You simply let the screen lock come on, and stay running quietly without consuming a lot of battery, and when the lock screen goes away, then you restore doing your business, but the gain to the end-user was they did not wait for a second or more while your app re-hydrated from a tombstone.   Since your app was never killed, response time is immediate. 

    Before we go much further on this topic, I do want to emphasize that running under lock is not an excuse so developers do not implement a super-fast, comprehensive tombstoning strategy. There are plenty of valid reasons why an app tombstones ( Choosers, App switching, etc.) that can’t be avoided, so you should still work hard to get the absolutely best tombstoning you can implement.

    Still, running under locked screen is a very nice to have for some apps, so I did a bit of digging and below are my tips, lessons learned, and even sample code, you can reuse to get your app to run under lock.

    Running Under Locked Screen
    In short, to let your application run under locked screen,  you must:

    1. Set PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Disabled;
    2. Handle the  Application’s RootFrame  Obscured and Unobscured events.  So you know when the lockscreen comes on.
      Obscured will be called when your app is getting locked.  Here, you should do as much as you can to minimize CPU or battery consumption. Stop all animations, stop making network calls, stop listening to accelerometer, or location changes, etc.. 
      Unobscured of course gets called when screens us getting unlocked. This is when the user comes back, and you pick where they left-off before phone went under the lock.
    3. [Optional] To have a great user experience with user in control,  you should prompt the user so they opt-in into running under lock.
    4. [Optional] You should expose as part of your application configuration settings an option for the user to change their mind or simply want to disable it and conserve power.
    5. There was only one gotcha that I noticed. If your application sets ApplicationDetectionMode to IdleDetectionMode.Disabled,  it can not change that back to IdleDetecionMode.Enabled until application is either launched again (so a full restart) or deactivated and then reactivated.

    Getting all this to run was trivial, but required a few more lines of code than the four items above (to save settings, fire events, etc.) .   I wrote this helper class called ApplicationIdleHelper.

    The class is a Singleton.  That is why the static Current property, so it can be shared throughout the app. The class supports change notification so you can bind to it. image

    • The class tracks three settings/properties:
      • RunsUnderLock is true if the user has elected to run under lock.  This setting is persisted across activations and launches of the app so we remember the user’s preference.  The property also supports change notification.
    • HasUserAgreedToRunUnderLock is true if the user was prompted using UI with a disclaimer that running under lock can consume battery.  This setting is serialized to ApplicationSetings, so that you don’t have to prompt the user every time.
    • IsRestartRequired is a transient property that does not get persisted. It simply flags whether the user has changed from IdleDetectionMode.Disabled to IdleDetectionMode.Enabled.  If we try set this transition, we will get an exception that tells us once Disabled is selected you can’t go back to Enabled.  Reality is that you can do it next time application is activated, so you just have to prompt the user to restart the app if they want the change to take place.
    • IsRunningUnderLock is a transient read-only property that supports change notification. This property tells you if the app is currently under a locked screen.  Good flag to make sure you are not doing work you are not supposed to, remember you are stealth under the lock screen (to preserve battery).
    • The application also supports three events:
      Locked  is fired when the Locked screen comes on. It is an abstraction so you don’t have to listen to RootFrame.Obscured event.
    • UnLocked fires when the application transitions from being in Locked state to it being in unlocked state and visible to the user. Again, equivalent to Unobscured event. 
       RestartRequired so that your classes are notified if the user has made a setting change that requires a restart (mainly going from IdleDetecionMode.Disabled to IdleDetecionMode.Enabled).

    That is all there is to it.  Plus, a bit of glue and a sample app for you to see it in action.

    About the sample app.

    WP7_1 (60)

    It is a very simple pivot app that plays music using MediaElement.
    You can toggle your preference to run under lock (or not to do that) by clicking the “Toggle current preference” button.
    You can play/stop music by pressing the Play/Stop button.
    The app will manage the settings for you. The UI under “Current settings” is data bounds to the ApplicationIdeleModeHelper so you can see it working.
    The events are fired properly too.

    Here are the behaviors you should see:

    If you are in the greedy pivot, and have chosen to  Run under Lock,  the music will continue playing under lock.
    If you are in the greedy pivot, but have not chosen to run under lock, the app will tombstone when the phone locks and there for the music will stop.
    If you are in the mellow pivot,  even if you have chosen to Run Under Lock,  the music will stop.  The application is not tombstoned, but it stoppped doing the work. It listens to the Locked event and stops doing work then, and then listens to Unlocked event and resumes there.  Again, without tombstoning. I just wanted to show you how you can “decrease” the work you do under lock, to avoid consuming battery.

    NOTE: To exercise the app you will need a device, as I don’t think the emulator runs under lock or simulates lock.  Also, when running this, make sure your device is not attached to Zune, as that will lock media library and prevent the app from playing music (and this sample does not throw error for that).

    The source for the app is on my Sky drive.  Let me know if you find issues or have questions.

    As my uncle used to say, “with great power comes great responsibility” ..  Running under lock is pretty neat, but advanced feature, do not abuse it.   Only use it for the kinds of apps that end-users would want to keep open even while locked.

    Happy Windows Phone coding!

  • Jaime Rodriguez

    Installing and viewing MSDN documentation for off-line consumption

    • 1 Comments


    The Windows Phone Marketpalce is upon us.. My apps are done and there are many, many apps getting submitted daily.  You gotta get cranking!!

    If you want to get the off-line docs so you can still work on your app when you are not connected to the internet, you are in luck because the final docs were recently published.
    All you need is10 minutes to download.. Follow the instructions below and you will be able to take the off-line docs anywhere you go..

    From the Windows Phone Developer Tools ( or a full blown version of Visual Studio where the tools have been installed).

    1. Click on Help –> Manage Help Settings
      image 
    2. In the Help Library Manager, click Install content from online
      image
    3. From the list, find Windows Phone Development and Click Add.
      While you are add it, you should add Silverlight, listed under Web Development
      image
    4. Click Update
      image 

    After installing the documentation you can access it by going to Help > View Help.
    If you are directed to the online version, you will need to change the setting to point to offline docs in the Help Library Manager by clicking on Choose online or local help.

    An out-of-browser experience
    By default, Visual Studio 2010 provides an in-browser experience.
    For an out-of-browser experience, you can also install the Help Viewer Power Tool (Beta) which will add indexing, search and an out-of-browser experience.
    Follow the instructions on the Help Viewer download site, and  you will end up with this:

                 image

    That should be all you need.  Happy Windows Phone coding!!

  • Jaime Rodriguez

    Windows Phone 7 Developer Events

    • 0 Comments

    Want to learn Windows Phone 7???  Booya!!

    Check out the line-up of events that our rocking Microsoft Windows Phone champs are organizing through out next month..   

    The perfect balance with one day of theory that covers all the fundamentals and a second day of hands-on coding action with access to phone experts..
    All of these of course are FREE!!   and they are local ( or nearby) all over the US..

    Want to be the know-it-all in the class,  then download the Complete Windows Phone Training Kit and get cranking on the hands-on-labs..  
    [Full details on the training kit here. Yochay Kiriaty pulled some amazing content for RTM ]

    Event Information and Registration Portal Page = www.msdnevents.com/wp7

    Event Schedule

    Day #

    Date

    City

    State

    Venue & Registration Link

    Day 1

    29-Sep

    Orange County

    CA

    Hilton Orange County

    Day 2

    30-Sep

    Orange County

    CA

    Hilton Orange County

    Day 1

    5-Oct

    Philadelphia

    PA

    Park Hyatt Philadelphia at the Bellevue

    Day 2

    6-Oct

    Philadelphia

    PA

    Park Hyatt Philadelphia at the Bellevue

    Day 1

    5-Oct

    Minneapolis

    MN

    Millennium Hotel Minneapolis

    Day 2

    6-Oct

    Minneapolis

    MN

    Millennium Hotel Minneapolis

    Day 1

    6-Oct

    Washington

    DC

    Renaissance Washington, DC Downtown Hotel

    Day 2

    7-Oct

    Washington

    DC

    Renaissance Washington, DC Downtown Hotel

    Day 1

    12-Oct

    Boston

    MA

    Royal Sonesta Hotel Boston

    Day 2

    13-Oct

    Boston

    MA

    Royal Sonesta Hotel Boston

    Day 1

    12-Oct

    Detroit

    MI

    Westin Book Cadillac Hotel

    Day 2

    13-Oct

    Detroit

    MI

    Westin Book Cadillac Hotel

    Day 1

    12-Oct

    Mountain View

    CA

    Microsoft Silicon Valley Office

    Day 2

    13-Oct

    Mountain View

    CA

    Microsoft Silicon Valley Office

    Day 1

    19-Oct

    Chicago

    IL

    Swissôtel Chicago

    Day 2

    20-Oct

    Chicago

    IL

    Swissôtel Chicago

    Day 1

    19-Oct

    New York

    NY

    Marriott Marquis

    Day 2

    20-Oct

    New York

    NY

    Marriott Marquis

    Day 1

    20-Oct

    Dallas

    TX

    InterContinental Hotel

    Day 2

    21-Oct

    Dallas

    TX

    InterContinental Hotel

    Day 1

    20-Oct

    San Francisco

    CA

    San Fran Design Center

    Day 2

    21-Oct

    San Francisco

    CA

    San Fran Design Center

    Day 1

    21-Oct

    Atlanta

    GA

    Georgia World Congress Center

    Day 2

    22-Oct

    Atlanta

    GA

    Georgia World Congress Center

    Happy Windows Phone coding!!

  • Jaime Rodriguez

    Introducing the Inside Windows Phone Show in Channel 9

    • 1 Comments


    Today, we are announcing a new Channel 9 show dedicated to Developing Windows Phone applications..   image

    The Inside Windows Phone show, homed at http://channel9.msdn.com/shows/Inside+Windows+Phone/ will bring an insiders’ scoop into Windows Phone.  Yochay Kiriaty and I will be doing our best to bring you geeky, transparent interviews from within the Windows Phone team…    

    Episodes for the show will be released every Friday. One show per week (at a minimum).

    You can watch our first 3 episodes today:

    Of course, we will also have external guests and guest hosts on the show; thanks in advance to all those that have and/or will contribute to it..

    Feedback and suggestions for the show are very welcome..  please also help us promote it..

  • Jaime Rodriguez

    Windows phone developers join me at Teched EMEA

    • 1 Comments

    CCL_audio_books.indd I will be doing a full-day pre-conference at TechEd EMEA covering Windows  Phone 7 .. 

    Check out the details for the talk here It is PRC04 - Windows Phone 7 Application Platform Technical Deep Dive.

    I am just going to summarize it with my very usual “we will go deep, we will share lessons learned instead of overview content”.. if you need more details than that, you can also check out my interview with the TechEd folks where we get into audiences and the content we will cover.. 

    I will also be doing a few presentations during the conference, so for any one attending the actual conference, please look me up too..  Trying to see if we can organize a XAP-athon event where you can book some time with me, bring your apps, run them on the phone, and I can help with as many tips as I can do in an hour or so (per app)…  Email me if you want in on that..

    Mega looking forward to this..  If you have suggestions on what I should cover, email me..  


    Happy Windows Phone coding!!

  • Jaime Rodriguez

    Windows Phone Design Day Recordings

    • 5 Comments

    Windows Phone is getting very impressive reviews, and all of them mention the great, innovative user experience on the phone. JustPhone


    A few weeks ago, our Studios team, the folks responsible for the end-to-end user experience on the phone, invited a few partners and agencies for what we called “Windows Phone Design Days”. 
    This was a 1.5 day deep-dive into their inspiration, philosophy, goals, and down to the 9mm details on implementation.  
    We recorded this event. The videos have not been edited, but this was such great content we are rushing for you to get it, below, please find links to the recordings.

    If you are a developer or designer looking to target Windows Phone, this is a must-watch series.  If you hold any kind of role related to software visual and interactive design, this should still be a great series for you to watch; you will get amazing insights into the research and the process that our teams go through to build stunning, award-winning experiences like the ones you have seen in Zune HD, and will see in Windows Phone.

    I have organized them in the order we presented them, but you can watch them in any order you want.  Just make sure you watch them all.

    Ana and Miles, the Windows Phone personas (  Tracey Lovejoy, 3:33 )
    The Metro Design Language, the inspiration  ( Jeff Fong, 29:48)
    Deconstructing a Windows Phone application part 1: Controls  (  Rhon Manlapaz,  Ryan Bickel, 17:40)
    Deconstructing a Windows Phone application part2: Animation ( Jeff Arnold,  34:22 )
    Deconstructing a Windows Phone application, part 3: Target Sizes (  Tirthankar Sengupta,  13:39 )
    Deconstructing a Windows Phone application, part 4: Globalization (Ayman Raslan, Franklin Yow : 37:45 )
    Deconstructing a Windows Phone application, part 6: Perceived performance  (19:45 )
    Designer insights into Panorama and Pivot ( Chad Roberts, Amy Alberts, 32:18)
    Making Audio Sing on Windows Phone (Matthew Bennett, 34:26 )
    Windows Phone Voice ( Karen Kesler, 32:00 )
    Designer Resources: Expression Blend Overview and Roadmap ( Celso Gomes, Peter Blois, 41:20 )
    Designer Resources:  Windows Phone Documentation ( Chris Kilbourn, 11:18 )
    Designer Resources: Windows Phone Design Templates ( Chad Roberts, 04:01 )

    If after watching all these insightful videos you feel inspired and want to get started,  go check this post with links to all the designer reso urces for Windows Phone. 

    Happy Windows Phone coding!

  • Jaime Rodriguez

    Windows Phone 7 performance white paper is now online.. got questions?

    • 1 Comments


    Shane Guillet has been working on Silverlight performance since way back when it was called WPF/E...  Shane wasprobably 14 years old then :)

    Recently, he wrote this great white paper on how to monitor and optimize performance on Windows Phone 7 apps.  
    Even if you are a performance expert, this is a great read, because Shane gets into the optimizations we have made on the platform, and how you can take advantage of these (e.g. with caching or simple animations on render thread) and he also gets into the hardware limitations (after all, it is a phone, not a PC).

    I actually was scheduled to interview Shane yesterday on Channel 9 to go over his demos and tips, but we had camera issues so we post-poned to monday..  If you have questions after readign the paper, send them my way and I can ask him...   Regardless check back in a week for the video, if the camera gods are friendly to us, we will have that here soon..

    Happy Windows Phone coding..

  • Jaime Rodriguez

    WPF ribbon has been released..

    • 6 Comments

    Congratulations to the WPF team in shipping the WPF ribbon control…

    You can download it, from:
    http://www.microsoft.com/downloads/details.aspx?FamilyID=2bfc3187-74aa-4154-a670-76ef8bc2a0b4&displaylang=en


    Highlights from their announcement:

    · New Controls – We have numerous new controls in this release of Ribbon such as, RibbonGallery, RibbonComboBox, RibbonMenuButton, RibbonSplitButton, QuickAccessToolbar, etc.

    · MVVM – Ribbon now facilitates MVVM-centric applications

    · KeyTips – The new Ribbon now implements this new accessibility feature to allow full control using the keyboard

    · Resizing – Our resizing approach has come a long way since the CTP version.  We have default logic that resizes controls inside the Ribbon to render the best visual appearance and orientation

    · Design-time – This release includes design-time support for Visual Studio 2010 and Expression Blend 4. This includes a project template for a ‘WPF Ribbon Application’, an item template for a ‘Ribbon Window’, and Ribbon controls in the toolbox such as, RibbonButton, RibbonToggleButton, RibbonMenuButton, etc.


    I have been heads down on phone for the last four months, so I have not played with ribbon recently, but they had every thing they describe above back then, so enjoy it!!

    By the way, they also relaxed the licensing;  the control it will be in the platform in the next WPF release, and does not require Office UI licensing.


    Happy ribbon coding!!    If you create a cool demo please let me know or leave it on the comments. 

  • Jaime Rodriguez

    Video recordings for first Windows Phone 7 Jumpstart event

    • 4 Comments

     

    This week, MS learning did the first delivery of our Windows Phone 7 Jumpstart training. 

    The JumpStart is a four part deep-dive into Windows Phone.  The four sessions included:

    1. An Introduction to the Windows Phone Platform
    2. Game Building on the Windows Phone Platform
    3. Advanced Windows Phone Development
    4. Selling Your Windows Phone Solutions & Wrap Up

    The reviews for the event were awesome.  Thousands of people attended. Everybody liked the presenters and the content.

    You can download all the content for the JumpStart from this MS Learning Website

    Below you can find links to the video recordings. 
    The recordings a little raw, they are captures of the sessions without edits, but the videos are great for learning Windows phone,  they go through fast, and are a must-see companion to the demos and ppts..

    If you missed out, on these great sessions check the MS Learning blog next month. I hear the events will be repeated often.

    Session one: Intro to the series and intro to Windows Phone platform:

    Session Two: Game building on Windows phone

    Session Three:  Advanced Windows Phone development ( life cycle, state management, push, etc.. )

    Session four: Selling your Windows Phone solution ( marketplace, A

    Happy Windows Phone coding..

  • Jaime Rodriguez

    Tips for uninstalling the Windows Phone Developer Tools CTPs and moving to beta

    • 2 Comments

    To install the Windows Phone Developer Tools beta, you will first need to uninstall the older CTP (if you had it installed).

    The process is straight forward if you get the order right and don’t have other pre-release bits installed.   All this means is

    1. You should uninstall the item named Microsoft Windows Phone Developer Tools CTP – ENU. That will chain the uninstall of other components.

    If you do run into issues (or you are reading this and already uninstalled in wrong order), the following blog posts have workarounds to the most common errors you will run into:

    1. You are trying to uninstall, but the software first wants to install something that is or was already installed. 
      Check this post
    2. You are getting an error installing the beta,  need tips to check for incompatible components.  Check this post
    3. Your install failed in the middle, or you have uninstalled components out of order and you need some brute force uninstaller.  Try this post

    I hope that does it; if not please try the Windows Phone forums.  You can also email me, but responses are much more delayed than at the forums; we have a great team monitoring the forums.

    Happy Windows Phone coding.

  • Jaime Rodriguez

    Migrating apps from Windows Phone April CTP Refresh to the beta build

    • 6 Comments


    There were a good number of breaking changes and new features introduced in the “beta” release of the Windows Phone Developer Tools.
    Going forward from beta to RTM; the number of breaking changes will be minimal, so let’s just “buckle up” and migrate our code this once.
    The migration is a lot easier than it sounds. I will first walk through the obvious breaking changes that the compiler will catch, and then share tips and workarounds in some of that ‘missing’ stuff that the compiler will miss. 
    Once you have gotten through this, don’t forget to read my post on the new features in the beta release so you can start taking advantage of these.

    Breaking changes:

    1. Namespaces and assembly changes:
      The following assemblies were removed, and merged into a single “Microsoft.Phone” assembly:
      Microsoft.Phone.Controls
      Microsoft.Phone.Controls.Navigation
      Microsoft.Phone.Controls.WebBrowser
      Microsoft.Phone.Controls.WebBrowserInterop
      Microsoft.Phone.Shell
      Microsoft.Phone.Notification
      Microsoft.Phone.Execution
      Microsoft.Phone.Info
      Microsoft.Phone.Tasks
      Microsoft.Devices
      To fix: change all your project references and all your namespaces declarations (xmlns) in XAML. See MigrationTips.1 below for details on namespaces.
    2. System.Device.Location assembly was merged into System.Device assembly
      To fix: change assembly references that were pointing to System.Device.Location and point them to System.Device assembly.
    3. Microsoft.Devices assembly was removed; the classes in this assembly were moved to Microsoft.Phone assembly.  Some of the classes changed namespaces, but not all.
      To fix: change assembly references and reference Microsoft.Phone assembly.
    4. Application.Resources have been removed from App.xaml and templates have been changed
      To fix: you will need to remove these from your own App.xaml. Can’t leave them in because it would break theming; also, there are breaking changes (controls removed) that would prevent your app from running if you do not get rid of the resources. See below on MigrationTips.2 for details on what to remove and how.
    5. ToggleControlSwitch and ToggleControlButton have been removed.
      To fix: You should  use ToggleButton and copy the template from RC version of ToggleControlSwitch. You will then need to add the touch gesture. Wait for a sample for this. I will post one soon.
    6. ListView and ListView Item were removed
      To fix: Use ListBox and a Template that matches the old ListViewItem template.
    7. Effects have been removed from the platform, this will be plan of record for v1 (the feature might come back later).
      In earlier builds, we had DropShadow, and Blur bitmap effects.  Unfortunately, these have been removed.
      Right now, your XAML is not breaking, but the usage of the effects is turning into a no-op.

      To fix: You should just remove the references to effects from XAML and code. You can use graphics (e.g. gradients for dropshadows) to try to get similar look & feel. Not exactly the same, but best workaround I can think of until Microsoft brings these back in a future version of the platform.

    8. A few classes were renamed or moved namespaces: 
      Type Old New New assembly
      (if changed)
      namespace Microsoft.Devices.NetworkInformation Microsoft.Phone.Net.NetworkInformation Microsoft.Phone.dll
      namespace Microsoft.Phone.License Microsoft.Phone.Marketplace Microsoft.Phone.dll
      class Microsoft.Phone.Controls.NavigatedEventArgs System.Windows.Navigation.NavigationEventArgs System.Windows.dll
      class Microsoft.Phone.Navigation.PhoneNavigationEventArgs System.Windows.Navigation.NavigationEventArgs System.Windows.dll
      class AccelerometerSensor Accelerometer  
      class AccelerometerReadingAsyncEventArgs AccelerometerReadingEventArgs  
      class AccelerometerStartFailedException AccelerometerFailedException  
      class WindowsPhoneEvents Microsoft.Phone.Shell.PhoneApplicationService Microsoft.Phone.dll
      class Microsoft.Phone.License.LicenseInfo Microsoft.Phone.Marketplace.LicenseInformation Microsoft.Phone.dll
      enum Microsoft.Phone.Shell.DownloadInterval Microsoft.Phone.Shell.UpdateInterval Microsoft.Phone.dll
      enum Microsoft.Phone.Shell.DownloadRecurrence Microsoft.Phone.Shell.UpdateRecurrence Microsoft.Phone.dll
      class NotificationChannelExceptionEventArgs NotificationChannelErrorEventArgs Microsoft.Phone.dll

      To fix: simply replace the namespace and/or class name and reference the new assembly (if applicable)

    9. Minor changes were made to the WMAppManifest.xml file
      1. XNA projects used to have an PlaceHolderString="Default task" on the WMAppManifiest.xml  this XML attribute is not longer valid.
         Fix: remove the attribute from manifest. .
      2. In the App element, the Genre attribute changed from NormalApp to Apps.Normal
      3. In the App element, the RuntimeType attribute changed from SilverLight to Silverlight.   {notice the case difference on the L}
    10. System.Reactive namespace was moved to Microsoft.Phone.Reactive and there is a new assembly called Microsoft.Phone.Reactive.dll
      The System.Concurrency and System.Disposable namespaces are now on this assembly.
    11. Removed ManipulationCompletedEventArgs.IsTapEvent property
      To fix: remove references to the property.  You can use OnClick handlers.
    12. Choosers API are no longer returning on OnChooserReturn; they now have instance based events.
      The PhoneNumberChooserTask and PhotoChooserTask used to always return on an override on the Page hosting. They now have events that the task exposes and you can add the handler and listen to the return from any class you like.  The tasks have a Completed event you can listen to.
    13. Other miscellaneous changes you might run into:
      1. The ApplicationBarIconButton has a new Text property and it can't be empty.. whitespace does not work either.
        You must enter something; old projects will get an InvalidOperationException with message of “Text cannot be empty” if you try to use the buttons with no text.  
        To fix:  enter some text for your button.
      2. OnOrientationChanging virtual method on PhoneApplicationPage has been removed; now you just get OnOrientationChanged
        To fix: remove references to Deprecated event
      3. Signature change on PhoneApplicationPage class
        override void OnNavigatedFrom(Microsoft.Phone.Navigation.PhoneNavigationEventArgs e)  becomes
        override void OnNavigatedFrom(System.Windows.Navigation.NavigationEventArgs e);
      4. AccelerometerReadingEventArgs was refactored and it no longer has a Value property wrapping the sensor data; you can now get to the X, Y, Z properties directly.
      5. I already mentioned that WindowsPhoneEvents class was replaced by  PhoneApplicationService class. 
        The events in these classes were also renamed from Paused to Deactivated and Resume to Activated.
      6. System.Windows.Browser.dll  has been finally removed. You should not have been using this assembly (since nothing worked, it was not supported).   The common reasons to look for this assembly included:
        HttpUtility class, which is in System.Windows.dll in the System.Net namespace.
        Interop between browser and Javascript.  If you are needing that, use the WebBrowser control and the ScriptNotify and
      7. Changed PhoneApplicationPage.ApplicationBar property from type ApplicationBar to IApplicationBar.
        Your old code should still work, but there might be a cast needed pending how you coded it.
      8. ManipulationDeltaEventArgs.CumulativeManipulation.Translation, ManipulationDeltaEventArgs.DeltaManipulation.Translation, and ManipulationDeltaEventArgs.TotalManipulation.Translation are now only populated when the user has moved certain number of pixels from original contact point.
      9. Scale property in ManipulationDeltaEventArgs.DeltaManipulation and ManipulationDeltaeventArgs.TotalManipulation has been changed to return 1 when there is no changes (instead of returning 0 in CTP Refresh); this mostly means you can go through your code, and remove the check you would have had to add before where you were detecting 0.0 and throwing it away.
    14. A few push notification changes (this list is best explained via sample,  the new TrainingKit has a great hands-on lab that will walk you through these changes )
      1. Microsoft.Phone.Notification went away, reference Microsoft.Phone
      2. Channel.ExceptionOccurred event is now Channel.ErrorOccurred
      3. HttpNotificationChannel.BindToShellNotification is now HttpNotificationChannel.BindToShellTile ()
      4. NotificationChannelExistsException has been removed.  You can now check if HttpNotificationChannel.IsShellTileBound before you bind to Shell
      5. ShellEntryPoint class is gone. We not use standard Uris
      6. HttpNotificationChannel.ShellNotificationReceived is now HttpNoficationChannel.ShellToastNotificationReceived 

    Steps for migrating your code (referenced above as MigrationTips.X ) :

    1. Fix all project references. 
      1. Remove references to Microsoft.Phone.Controls, Microsoft.Phone.Controls.Navigation, Microsoft.Phone.Controls.WebBrowser, Microsoft.Controls.WebBrowser.interop
      2. Add a reference to Microsoft.Phone assembly
      3. Do a global search and replace for the xmlns declarations. For example:
        Search for Replace with
        clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Navigation clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone
        clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.WebBrowser clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone
        clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone.Shell clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone
        clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone
           

        The list above is not all inclusive, but it is the most common one and shows you the “pattern” to use: don’t replace the whole xmlns declaration, just replace the clr-namespace strings, and your code will be easier to migrate.  The search above can be applied to just XAML files, making it slightly quicker to replace all.
    2. Fixing themes and App.xaml resources issues:
      Assuming you had not added your own resources,
      1. open App.xaml and remove all the Application.Resources
      2. Do a global find/replace for following strings, these are resources that were in App.xaml but are not automatically inserted by the run-time. Most of these are used by the default Mainpage.xaml that every new project includes:
    3. Search for Replace with:
      PhoneTextPageTitle1Style  PhoneTextNormalStyle
      PhoneTextPageTitle2Style PhoneTextTitle1Style
      PhoneTextApplicationNameStyle PhoneTextNormalStyle
      PhoneTextTitleNameStyle PhoneTextTitle1Style
    4. Fixing your WMAppManifest.xml file
      1. The easiest way to fix your manifest is to create a new empty project with same name than your existing one, and copy the whole WMAppManifest to your project.  You can also copy a few of the attributes, elements. These are the commone ones to watch out for:
      2. XNA projects used to have an PlaceHolderString="Default task" on the WMAppManifiest.xml  this XML attribute is not longer valid, please remove it.
      3. In the App element, the Genre attribute changed from NormalApp to Apps.Normal
      4. In the App element, the RuntimeType attribute changed from SilverLight to Silverlight.   {notice the case difference on the L}
      5. Do clean-up or update the auto-generated metadata on your WMAppManifest, including App.Author, App.Description and App.Publisher
      6. If you do not have capabilities (maybe you were not using refresh but MIX build) copy the whole  <App><Capabilities> element from the empty project to yours
      7. <Tasks> collection has a <DefaultTask> element with a new NavigationPage attribute.  In previous builds this was set via code in App.xaml via the <Application.RootVisual> you can use either. They both work, just make sure you have one or the other approach (and not both)
    5. Remove old workarounds:
      1. Remove checking for 0 == ManipulationDeltaEventArgs.*.Scale.
      2. TransformToVisual and FindElementsInHostCoordinates. Orientation has been fixed and now we rotate the application frame, so these workarounds are no longer needed.
      3. You can now reference signed assemblies again, so if you had used the workaround to unsign them, you can remove it again.

    Closing Advise/asks:
    Please share back your experiences and tips!!    I know this document is not 100% comprehensive. If you run into one change that I missed or get stuck along the way, please email me directly [via email blog author on the sidebar column] so we can update and improve this document.

    Don’t forget to read the release notes. This document overlaps with some of the content in the release notes, but I focused on migration, so there are other tips and known issues there that will be useful to you; please take a look at the release notes. 

    Happy Windows Phone coding!

  • Jaime Rodriguez

    WIndows phone developers please hold on Blend 4

    • 2 Comments

    Today at Internet Week New York we are launching Expression Studio 4.
    This new version is shipping just 10 months after Expression Studio 3 and includes support for Silverlight 4, .NET 4, and interop with Visual Studio 2010 and TFS 2010.

    In this version we are also moving to a new SKU lineup which aligns with the new Visual Studio and MSDN levels. There are now three levels of Expression Studio: Expression Studio Web Pro, Expression Studio Premium, and Expression Studio Ultimate.

    Important Note: If you are developing in Silverlight for Windows Phone 7, do not install the released version of Expression Studio 4. You must continue to use the Blend 4 Beta and Add-in Preview for Windows Phone. This Beta will be refreshed with each Phone SDK pre-release and will be unified with released Blend 4 in a service pack which will release when the Windows Phone SDK releases.

    Congratulations to the Blend team!

  • Jaime Rodriguez

    A transparent Windows PHONE FAQ

    • 0 Comments

    I had two long flights this week and I caught up with all my reading of internal Windows Phone discussions.  
    There were some great questions (and answers) that I have not seen externally – some of it on not yet announced changes or fixes; don’t hold me against these, mostly sharing so you can plan your app’s road map-. I was taking notes, and turned it into an FAQ,  you can now find these at our Learning Windows Phone Site’s FAQ

    I hope it is useful; will try to update it every few weeks on friday’s so bookmark it and check it often..  

    Also while shamelessly plugging great content, don’t forget that we released the April CTP version of the Windows Phone Training Kit this week too.    You can get either an offline version  or an online version

    Please feel free to spread the word on these two.  

    Thanks!!

Page 2 of 9 (222 items) 12345»