About the author

Brian Keating is a developer addicted to Microsoft Technologies.

Month List

RecentComments

Comment RSS

Silverlight Fluid Motion

clock September 19, 2011 13:05 by author Brian Keating |

 

You know what?
I love Silverlight!

The only reason I don’t spend more time in it is the ASP is more suited to non enterprise applications.
However tonight for you dear reader I’ve got an enterprise application (below)

image

(because every enterprise had an application that shows pictures Smile; yes really this was a requirement honest Be right back)

Blend

So you are writing a sliverlight app, or course you could code it all by hand.

In the last year, I’ve even met Silverlight/WPF programmers, lets call them Xamlers, that turn their nose up at using a designer, hey I’m sure it’s got it’s advantages and these people know XAML better than me, but IMO life is too short and programmers are too expensive to be living in notepad. Would you code your designer code in a windows forms app? not use scaffolding in MVC? etc etc..

For me Blend is blessing in disguise, I’m not sure the mythical devigner that is both an amazing designer AND an amazing coder (term coined by Scott Hanselman I think)  exists, but Blend does really help.

Overview

The application is simple, It selects some pictures in a folder and displays them in a list. When an item is selected in the list the picture should zoom out from the listbox item and scale to it’s full size.

Simple ey… yes of course (when you know how).

 

Steps

1. Create a new expression blend silverlight project

image

2. Add a sample datasource, some text and a picture

image

image

image

3. Drag the collection onto the page

image

4) Select details mode in the properties pane, and drag out property 2

image

image

If you were now to run your application you’d see that when you select a picture it appears in the main picture also. But our requirements were to slide out the picture from the list itself.

5) Select the big picture and drag fluid move behaviour onto it

image

6) Change the tag property to datacontext

image

Now do the same for the Itemtemplate

image

7) Drop a FluidMotionSetTagBehaviour onto the image part,setting the datacontext

image

 

 

That’s all that’s needed, you app should now run, animations and all.

image

I would provide the sample but I’ve used 11megs of pictures so it’s a little too big to expect you to wait for Smile

I might get some time to reproduce this app in html5, android, c++, java would be nice to compare and contrast.

Start blending xamlers!




Microsoft Synchronization Services, WCF OData, Sql Azure, WPF, iPhone

clock June 16, 2011 21:07 by author Brian Keating |
Part1 – Setting up your database

I did some work with an interesting piece of tech lately, Microsoft Syncronization services 4.0 CTP. This post aims to give an overview of where to start, but firstly, let me describe the how all this plugs together and what it buys me.

Overview

The OData + Sync protocol uses the OData format for the data payload that can be consumed by clients that are running on any platform. Clients and the service use the protocol to perform synchronization, where a full synchronization is performed the first time and incremental synchronization is performed subsequent times. The protocol is designed with the goal to make it easy to implement the client-side of the protocol, and most (if not all) of the synchronization logic will be running on the service side. OData + Sync is intended to be used to enable synchronization for a variety of sources including, but not limited to, relational databases and file systems.

Server

The CTP release includes server components that make it easy for you to build a sync Web service that exposes data to be synchronized via the OData + Sync protocol. For example, you can easily expose data in a SQL Server database or a SQL Azure database via a WCF sync endpoint using these server components. In our case our server in sitting in the Azure Cloud providing an OData endpoint, the data is also hosted in the Cloud in Sq1 Azure.

Clients

We have 3 clients, (well 4 actually but our Silverlight version has lagged behind and in not yet publically available).

  1. WP7 – Local data stored in Isolated Storage, DataVisualizationToolkit for charting, SL3
  2. iPhone – Connecting directly to the server via OData/Json
  3. ASP.MVC Ajax – A powerful web interface written using MVC3 and jQuery
  4. Silverlight – Initially used RIA Services to access the server but synchronization model is nearly identical to the WP7 SL3 approach with isolated storage now.

How to create the server.

  1. Create you database schema in SSMS (SqlServer managment studio)
  2. Now that your database has been created you’ll need to provision it, think of this much in the same way that you would provision an existing sql server database for asp membership tables and stored procedures. The syncronization framework will provide you with a tool called SyncSvcUtilHelper.exe this basically is a GUI for the command line version.

image

before provisioning you’ll need to create a Sync configuration, so choose option on, select a filename in step 1 and select your database in step2

image

image

Select the list of tables that you are interested in syncing

image

That’s pretty much it. Now you’ll need to choose option2 to provision the database.
Select the configuration file you created as part of step 1 and choose the provisioning option.

image

That’s all that’s involved, your Database is now ready to be synchronized, of course there are come considerations, unique id’s etc, but you’ll find all this in the documentation.

 

My next post will cover creating the WCF service for exposing the database, after that I’ll run through creating the clients.




Xaml gotya

clock December 6, 2010 19:51 by author Brian Keating |

Here's one I'm ashamed to admit caught me as I was finishing up work this evening, it's been a good few weeks since I've gone near wpf/silverlight given I was on holidays and spend my time playing with WF4 and MVC2.

Anyway in screenshot below.. vs2010 .net 3.5 sp1 I was binding some data to a datagrid.

 I omitted to remove the offending closing xml comment you can see in the xaml "-->"

And low and behold the binding breaks down without any prior warning,,,, infact my object collection is totally ignored and the "-->" is passed to the binding, I know this because I removed the binding paths in the columns and was presented with "-->" in my grid...

Just an interesting one to keep in mind.. If you're like me, u couldn't switch off the computer this evening until this peculiar behaviour was explained..

 

Maybe it will save you some time if you come accross it.

 




Silverlight extra day of PDC...

clock November 17, 2010 16:34 by author Brian Keating |

Register now!

 

Learn about the future of Silverlight from Corporate Vice President, Scott Guthrie and other experts, direct from Microsoft’s HQ.

http://www.silverlight.net/news/events/firestarter/

 

If you are a INETA User Group Leader or INETA Country Lead er, please help us to deliver this message and spread it. Thanks!

 




WaitCursor and MVVM

clock June 3, 2010 16:43 by author Brian Keating |

Ever wondered how to display the correct cursor in an application that is databinded to async methods?

Pretty easy solution, just databind the cursor on the window itself.

Here's how:

  • Add an IsBusy property on the DataContext (and implement INotifyPropertyChanged on it)
  • Addt the following to your window xaml

xmlns:valueConverters="clr-namespace:XXX.ValueConverters"
Cursor="{Binding IsBusy, Converter={valueConverters:CursorExtensionConverter}}" 

 

  • Create the following ValueConverter

public class CursorExtensionConverter : MarkupExtension, IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        if (value != null && ((bool)value))
            return Cursors.Wait;           
        else
            return Cursors.Arrow;
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        throw new NotImplementedException();
    }

    public override object ProvideValue(IServiceProvider serviceProvider)
    {
        return instance;
    }

    private static CursorExtensionConverter instance = new CursorExtensionConverter();
}

 

Note: Use of MarkupExtension