Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
5124
Cascading XamComboEditors in XamGrid (with RIA Services)
posted

I'd like to share a useful sample demonstrating XamComboEditors used as cascading filters in a XamGrid in Silverlight 4.  The sample was created for a customer by our Developer Support team (kudos primarily to Jason D).  The sample is in VB.NET as per the customer's specs, so I hope to have a C# version at a later date.

The sample uses RIA services to provide server-side data access; and in this case the data is coming from a code class in the web project itself, not from an external source, so you should be able to run this sample stand-alone.  To do this, the DomainService class returns IQueryable objects based on the ObservableCollections provided by the Data Model.

The XamGrid has related Country, State, and City columns.  Selecting a Country causes the State drop-down items to be filtered by Country, and so on.

I hope this sample is a useful guide. Again, I hope to have a C# version soon.  Please feel free to post any comments, questions and improvements.

XamGridCascadingCombos_vb.zip
Parents
No Data
Reply
  • 375
    Offline posted

    Francis,

    I’m finding this sample difficult to work with as I’m not very familiar with a few things like VB,  Linq, RIA, etc.  So I’m creating a simplified version in c# which emulates something more similar to how I would be using it with a few assumptions:

    ·         The developer already has a way to fetch the data from the server and manipulating (filtering) the data will all be done client side.

    ·         The list of states and counties can be persisted in static collections client side.

    I got the converters to work only part way as I used code from the sample project “XamWebGrid_Testing” from Matt which was easier for me to understand, but they don’t do all the work needed.

     

    A problem in both projects (yours and mine) is when we click into a grid cell for edit, the XamComboEditor does not have the current item selected in its list (no item is selected).  The appropriate behavior is to have the current item selected in the list as it would be if we were working in a data entry screen (window).

     

    The problems with my sample are:

    1.       The XamComboEditors are not writing to the underlying property (probably because I don’t have the converter properly setup)

    2.       The County dropdown is not being filtered by the state combo’s selection yet.  I have a static method that will return a filtered list of counties (CountyHelper. GetCountiesByStateId) we can use if it helps any.

     

    Can you please help me get this sample running correctly?  It will probably be good code to offer to others with similar needs.  I did a lot of googling and your post is the ONLY one I’ve found regarding using a XamComboEditor in a xamgrid.

     

    Thanks.

    XamGridComboEditor.zip
Children