View Model Pattern with .NET RIA Services

This blog post revisits the view model pattern, this time in the context of .NET RIA Services. It shows how a DomainContext can be used within a view model, along with various Silverlight.FX features such as actions, event triggers and behaviors.

Over the weekend, I saw a question on StackOverflow about combining .NET RIA Services and the ViewModel pattern and answered briefly there, but the topic is worthy of a blog post.

At a high level, .NET RIA Services generates a data model for use in the client presentation tier based on the application logic you author for the server portion of your application. The question is how could/should this data model fit into a view model. I blogged about the ViewModel pattern a long while back in the context of my Silverlight.FX work. This post will take care of a few things at the same time: (a) show how the two work together, and (b) show how the work in Silverlight.FX itself has evolved over time.

For most of the post, I'll walk you through a basic .NET RIA Services application. I'll of course use my favorite scenario, a Product catalog.

Data Model on Server

For my server end of things, I'll define my data model under a DataModel folder/namespace. For this app, I'll have a Product class as my entity type and a ProductRepository class that contains a static list of products (for simplicity) to serve as my data access layer.

DAL Classes

Domain Logic on Server

The first step is to define the set of operations on the middle tier. This is where I'll use .NET RIA Services to package up that application logic in the form of a DomainService. The point of the "DomainService" name is that it is the stateless object that represents a specific domain that is characteristic of my application. My application is a simple product catalog, and correspondingly I'm going to name my class Catalog. Its going to have a simple method for searching the products in the catalog.

namespace MyApp.DomainLogic {

    [EnableClientAccess]
    public class Catalog : DomainService {

        public IQueryable<Product> GetProducts(string keyword) {
            if (String.IsNullOrEmpty(keyword)) {
                return null;
            }
            keyword = keyword.ToLower();

            ProductRepository repository = new ProductRepository();
            return from p in repository.FindAllProducts()
                   where (p.Name.ToLower().IndexOf(keyword) >= 0) ||
                         (p.Description.ToLower().IndexOf(keyword) >= 0)
                   select p;
        }
    }
}

Generated Data Model on Client

Since I marked this class with [EnableClientAccess], the .NET RIA Services tooling generates a corresponding Catalog DomainContext representing the client-side data model with the following significant members: a list of products, and a method to load that list of products. Behind the scenes, the method consumes the query method I defined on the server to fetch the matching list of products.

namespace MyApp.DomainLogic {

    public partial class Catalog : DomainContext {

        public EntityList<Product> Products {
            get { ... }
        }

        public void LoadProducts(string keyword);
    }
}

XAML View

The next step I am going to take up is defining the view itself. I am going to use a DataGrid control for display a list of search results, and a DataForm control for displaying details of the selected product. Here are the significant pieces of the overall XAML markup:

<UserControl>
  <TextBox x:Name="searchTextBox" VerticalAlignment="Center" />
  <Button x:Name="searchButton" Content="Search" />

  <ProgressBar x:Name="searchProgressBar" Opacity="0" IsIndeterminate="True" />

  <dg:DataGrid x:Name="productsGrid"
    SelectionMode="Single">
    <dg:DataGrid.Columns>
      ...
    </dg:DataGrid.Columns>
  </dg:DataGrid>
    
  <df:DataForm x:Name="productForm" Header="Product">
    <df:DataForm.DisplayTemplate>
      <DataTemplate>
        <StackPanel>
          <TextBlock Text="{Binding Name}" FontWeight="Bold" />
          ...
        </StackPanel>
      </DataTemplate>
    </df:DataForm.DisplayTemplate>
  </df:DataForm>
</UserControl>

The Associated View Model

This XAML doesn't have any functionality yet. For that I am going to implement my view model class, and then hook the two up together. My view model is going to allow searching for products, and supplying the list of resulting products. It is also going to track the selected product as the user changes the selection. Here is the code:

ViewModel Class

public class SearchViewModel : Model {

    private Catalog _catalog;
    private Product _selectedProduct;

    public SearchViewModel() {
        _catalog = new Catalog();
        _catalog.Loaded += OnCatalogLoaded;
    }

    public IEnumerable<Product> Products {
        get {
            return _catalog.Products;
        }
    }

    public Product SelectedProduct {
        get {
            return _selectedProduct;
        }
        set {
            if (_selectedProduct != value) {
                _selectedProduct = value;
                RaisePropertyChanged("SelectedProduct");
            }
        }
    }

    public event EventHandler SearchCompleted;

    public event EventHandler SearchStarting;

    private void OnCatalogLoaded(object sender, LoadedDataEventArgs e) {
        SelectedProduct = _catalog.Products.FirstOrDefault();
        RaisePropertyChanged("Products");

        if (SearchCompleted != null) {
            SearchCompleted(this, EventArgs.Empty);
        }
    }

    public void Search(string keyword) {
        keyword = keyword.Trim();
        if (keyword.Length == 0) {
            return;
        }

        if (SearchStarting != null) {
            SearchStarting(this, EventArgs.Empty);
        }

        _catalog.Products.Clear();
        _catalog.LoadProducts(keyword);
    }
}

The first thing to notice is the use of the Model base class, which is a utility class offered by Silverlight.FX that takes care of implementing INotifyPropertyChange, as well as caching and batching property change events.

The view model encapsulates the underlying data model that was generated in the form of a Catalog class and its Products entity list. In turn the view model exposes a Search operation (which takes in a keyword), and the list of resulting products. It also supports tracking selection via a SelectedProduct property.

Associating the View and its ViewModel

Now that we have both our view and view model, it is time to hook the two up together.

Instead of using UserControl has my root element, I am going to use Window, a derived UserControl from Silverlight.FX, as it has functionality to associate a ViewModel instance. Specifically it instantiates the view model, sets it as the DataContext, and also associates it as the model for the all elements contained within its scope. We'll see that used in a moment.

<fxui:Window
  xmlns:fxui="clr-namespace:SilverlightFX.UserInterface;assembly=SilverlightFX"
  ModelType="SearchViewModel">
  ...
</fxui:Window>

Next I'll use standard data-binding to bind properties in the view to properties on the view model.

<dg:DataGrid x:Name="productsGrid"
  ItemsSource="{Binding Products}"
  SelectedItem="{Binding SelectedProduct, Mode=TwoWay}">
  ...
</dg:DataGrid>

<df:DataForm x:Name="productForm"
  CurrentItem="{Binding SelectedProduct}">
  ...
</df:DataForm>

Next I want to hook up the Search button to the Search method on the view model to trigger the loading of the matching products. The Search operation is essentially a command, and while a command binding could be used (also supported in Silverlight.FX), instead I am going to use a much simpler concept as introduced in Silverlight.FX - an invoke script action that is equivalent to binding events to methods.

<Button x:Name="searchButton" Content="Search" 
  fxui:Interaction.Action="$model.Search(searchTextBox.Text)"/>

Interaction.Action is a shortcut for associating an InvokeScriptAction on Click trigger associated with a Button. Here I am referring to the associated model, using $model, and then invoking the Search method on it. As the search method takes in a string parameter, I am passing in the Text property of the searchTextBox in. The action takes care of finding the textbox control, and retrieving its text.

Finally my SearchViewModel class exposes a couple of events. I'd like to handle those events in the view, and respond accordingly. Specifically, I want to hide/show the progress bar in response to the SearchCompleted and SearchStarting events. To do that I am going to define two visual states for my view.

<vsm:VisualStateManager.VisualStateGroups>
  <vsm:VisualStateGroup x:Name="SearchStates">
    <vsm:VisualState x:Name="Searching">
      <Storyboard>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="searchProgressBar"
          Storyboard.TargetProperty="Opacity">
          <EasingDoubleKeyFrame KeyTime="00:00:0.25" Value="1"/>
        </DoubleAnimationUsingKeyFrames>
      </Storyboard>
    </vsm:VisualState>
    <vsm:VisualState x:Name="Searched">
      <Storyboard>
        <DoubleAnimationUsingKeyFrames Storyboard.TargetName="searchProgressBar"
          Storyboard.TargetProperty="Opacity">
          <EasingDoubleKeyFrame KeyTime="00:00:0.25" Value="0"/>
        </DoubleAnimationUsingKeyFrames>
      </Storyboard>
    </vsm:VisualState>
  </vsm:VisualStateGroup>
</vsm:VisualStateManager.VisualStateGroups>

And I'll use event triggers provided by Silverlight.FX to respond to those events, and declaratively perform visual state transitions.

<fxui:Window
  xmlns:fxui="clr-namespace:SilverlightFX.UserInterface;assembly=SilverlightFX"
  ModelType="SearchViewModel">

  <fxui:Interaction.Triggers>
    <fxui:EventTrigger SourceName="$model" EventName="SearchStarting">
      <fxaction:GoToState StateName="Searching" />
    </fxui:EventTrigger>
    <fxui:EventTrigger SourceName="$model" EventName="SearchCompleted">
      <fxaction:GoToState StateName="Searched" />
    </fxui:EventTrigger>
  </fxui:Interaction.Triggers>
</fxui:Window>

Here again you'll see the use of $model. By default EventTrigger listens to events on the associated view element (i.e. fxui:Window in this case), but specifying sourceName to be $model tells the event triggers to listen to events on the associated model. The actions, fxaction:GoToState declaratively transitions visual states.

There you have it. The view is now hooked up to the properties, methods and events on the view model, and our application works end-to-end, for this simple search scenario.

Designer/Developer Workflow and Going Further

The view model is completely decoupled from the view. The developer can focus on the data model, domain logic and view models in the application, while the designer can focus on creating the best user experience in the view. Bringing these two worlds together involves binding and hooking the view to its associated view model using various declarative constructs - such as data-binding, actions, triggers and commands.

Of course the designer can add other interactivity to the view as well... without necessarily writing lots or on many occasions, any code. Since this is a search form, I'd like to have the enter key press within the textbox to automatically trigger the Click event of the search button. That can be simply done by attaching the AutoCommit behavior to the TextBox:

<TextBox x:Name="searchTextBox">
  <fxui:Interaction.Behaviors>
    <fxui:AutoCommit ButtonName="searchButton" />
  </fxui:Interaction.Behaviors>
</TextBox>

Similarly, I could also add an AutoComplete behavior from Silverlight.FX to the same textbox to add in some functionality to remember the last few searches, a Watermark behavior to include an inline prompt, and so on.

The ViewModel Pattern At Play

I've got a slightly revised diagram from when I initially posted a while back.

ViewModel Pattern

The key points here are:

  1. The generated Entity types and DomainContext from .NET RIA Services form the data model. They are designed to be bindable. They support change notifications, expose operations etc. So while they can be used as a view model directly, often times you will in fact have client-side application logic, and will expose bits of your data model through a separate view model type you author.
  2. I personally like to think of a view model type as any vanilla class in terms of its structure: properties, methods and events at the very least, and optionally, but almost always, change notifications as a special type of event. The view model is decoupled from the view. The consumer might be a view, and it might also be unit test.
  3. The view is mostly XAML, and while it might contain minimal code-behind, declarative building blocks like behaviors, actions, and triggers go a long way in helping express interactivity through XAML. The view binds to its associated view model to get/set properties, invoke methods, and listen to events.

You can download the entire project along with all the source code. You'll need to install the Silverlight 3 developer runtime and tooling along with the .NET RIA Services CTP to compile and run the app. Note that the Silverlight.FX functionality itself works in Silverlight 2 as well.

Enjoy!

Posted on Monday, 4/20/2009 @ 12:55 AM | #Silverlight


Comments

30 comments have been posted.

Deepak Chawla

Posted on 4/20/2009 @ 2:02 AM
Thanks Nikhil,
I did raise the same issue on your blog in the URL pastes above. Also raised it with Scott Guthrie, Stephan Walthers, hansellman etc etc. but no response.
I saw your presentation Mix 09 and also upgrading my self to use Microsoft MVC. And the throught that there has to be a mash between the two.

Clear division of concerns and RIA.

Found something else as well the KOBE project. Will see how much additional value that will provide and get back.

Regards,
Deepak Chawla

Simon Ferquel

Posted on 4/20/2009 @ 3:04 AM
Your sample is good for this kind of scenario. But what I'm trying to fix, is a scenario with RIA Services Server-side paging. In Fact, you can benefit of the Paging-enabled controls only with a DomainDataSource (as it requires an implementation of IPagedCollectionView as well as ICollectionView to work correctly... and the only implementation working with server-side paging is internal, and implemented by the DomainDataSource control). The problem is that DomainDataSource requires a DomainContext. Exposing the DomainContext by the ViewModel seems wrong to me, especially concerning Design-time sample-data declaration (very usefull feature of Blend btw), and for testability / mocking purpose. Have you some propositions to make for this ?
What I would like is a genericly-typed implementation of ICollectionView, IPagedCollectionView and IEnumerable<T> relying on RIA Services and exposable without the whole DomainContext thing. After that, for DesignTime / mocking scenarii, we could simply define a static List<T> with sample data in place of the server-side paged collection.

Thanks

Jeremy

Posted on 4/20/2009 @ 6:02 AM
Like Simon, I am also interested how you fit the DomainDataSource in the MVVM pattern. Can you give some insight on this?

Nikhil Kothari

Posted on 4/20/2009 @ 7:39 AM
@Simon, @Jeremy -
We are thinking about what is the best way to implement paging support in a view model. I agree in most cases you don't want to expose a DomainContext directly from your ViewModel.

We will have generic implementations of CollectionView, but probably not of something that supports paging, since that aspect is quite coupled to how a collection should be loaded, rather than being something you layer over any generic collection. Instead...

Here is one approach:
- Expose the following from your view model: Products, CanMovePrevious, CanMoveNext, CanMoveToPage, MovePrevious(), MoveNext(), MoveToPage(), and Pages.
- Bind Next/Prev buttons to CanMovePrevious, CanMoveNext and MoveNext(), MovePrevious().
- Create an ItemsControl bound to Pages, with an ItemTemplate containing a Button bound to the MoveToPage() method

In your methods, you load in the right data, and update the Products property, amongst others. So in a sense, you're building a pager out of individual UI bits bound to bits of view model. Its a bit of work... as you might imagine.

Here is another approach that I've recently started to think about:
- Make the DomainDataSource (or actually another DataSource) that is in tune with the view model.

The view model exposes a Load operation that takes in parameters (much like the Search method), and it also takes in parameters for paging etc. This allows the view model to control loading of the data, but allows the data source to figure out when to load data, support the DataPager by virtue of exposing IPagedCollectionView etc.

As I mentioned... still thinking...

Colin Blair

Posted on 4/20/2009 @ 8:19 AM
@Nikhil

I inherited DomainContext from a ViewModel to simulate what you are thinking about, flowing all of the data requests to the real DomainContext. Loading data was easy but SaveChanges isn't overridable so I had to do some really ugly overriding in the DataAdapter to make it work. What I learned is that the pattern of a DomainDataSource variant that can connect to the ViewModel could be really powerful so I hope you can figure it out.

Deepak Chawla

Posted on 4/20/2009 @ 9:25 AM
Hi Nikhil,
Being new to Microsoft MVC and RIA, I've gone through the example suggested explained above. The delivery of the Model to the client/view has been divided among silverlight client and the Domain Context.

The Domain Context then calls the Domain Service for the relevant data. All was good till this point.
Could we not call a Controller class? Which then decides the repository either live or my test repository.

And that would make this perfect.

Also for Simon's problem the solution could be the same. The controller class decides the data flow. Following is a snippet from NerdDinner example.
//
// GET: /Dinners/
// /Dinners/Page/2

public ActionResult Index(int? page) {

const int pageSize = 10;

var upcomingDinners = dinnerRepository.FindUpcomingDinners();
var paginatedDinners = new PaginatedList<Dinner>(upcomingDinners, page ?? 0, pageSize);

return View(paginatedDinners);
}

Now if we could get the DomainContext to call the Controller and then the Controller pass to the correct DomainService. I think we have a winner here.

Thanks
Deepak Chawla

Fredrik Normén

Posted on 4/20/2009 @ 9:29 AM
@Nikhil:

Wouldn't it be better to use DIP, so you don't make your ViewModel dependent on a detail instead make it dependent on an abstraction? In your solution you have a dependency to the Catalog (Would prefer CatalogService because I prefer to use it as my "Service Layer"). By avoiding dependency to details, you will increase both testability and maintainability, just a thought ;)

Nikhil Kothari

Posted on 4/20/2009 @ 11:18 AM
@Deepak -
In .NET RIA Services, you're authoring a domain service, and the framework takes care of exposing an endpoint, so you don't need a specific controller in addition to a domain service. That said, we do want MVC apps to be able to use a domain service, and are going to enable the scenario of writing such a controller and making it simpler than what it is today.

@Fredrik -
Yes, I could define an ICatalog and have my view model consume that, so it can be mocked. It works quite well. In fact, the Silverlight.FX framework knows about instantiating view models against an IoC container to resolve dependencies. However, I wanted to keep this particular sample simple...

mikekidder

Posted on 4/20/2009 @ 1:51 PM
Is it just me, or the query request/response slow? I thought it was the storyboard animation triggers (removed from XAML to test), but when I query on my localhost its taking approx 2-3secs for the GET request to come back. Is their a delay loop hidden somewhere for this demo I am missing?

mikekidder

Posted on 4/20/2009 @ 4:54 PM
duh! nevermind, found it... Thread.Sleep(2000) in catalog.cs

Nikhil Kothari

Posted on 4/20/2009 @ 5:10 PM
@Mike - yep, I put in the sleep explicitly to simulate latency :-)

Joe Smith

Posted on 4/20/2009 @ 6:16 PM
Nikhil,

Great article. Do you have examples of adding additional data sources like from Velocity distributed caching? Or a high level how I could do that?

Nikhil Kothari

Posted on 4/20/2009 @ 6:39 PM
@Josh
Velocity is a server-side component (at least right now). You can integrate that or other caching technology into your domain service implementation. For example, when I implemented GetProducts in my Catalog DomainService, I could have looked up a cache instead of going to the data layer directly.

Khurram

Posted on 4/23/2009 @ 1:24 AM
Nikhil,
I've been using your "spare time" projects like script#, web dev helper to design my applications and I like what you do. But I would like to give you some inputs based on my experience with the RIA. I've been experimenting WPF and Silverlight with MVVM and I would say its neat and clean thing. But when we talk about RIA there are a number of other issues (i.e keeping state on the client side etc.) which requires attention before start development of any large scale RIA. Right now there is no solid framework in Silverlight world which solves most of the problems in RIA world. Silverlight.FX is on right track but I doubt that someone can push an application with more than 20 large use cases with this framework. Its pretty good to show the demos or for the small apps but not for the enterprise apps. On the other side of the RIA world, we have Adobe platform Flex/Air, which is more or less the equilevent of our beloved Silverlight. Flex has been in the markete for a long time and not its natural for them to not only have a strong community but also some really good and proven patterns/architecture/frameworks to push large scale apps. I've myself delivered a large scale complex app using Flex and the framework we used was Cairngorm (http://www.adobe.com/devnet/flex/articles/cairngorm_pt1.html) I'm quite impressed with Cairngorm and it solves almost all of the problems we could have in designing and developing enterprise scale RIA applications. There is a Silverlight port of Cairngorm on codeplex. Its not completed but still a very useful blueprint. It'll be really great if Silverlight.FX will be able to play the part what Cairngorm has played in RIA world. And It'll be really great if you give a look at this framework and put some of the really useful things in Silverlight.FX. I'm not evanglizing Flex/Cairngorm thing here, but the thing is that is proven and tested set of patterns & now Silverlight community really wants something enterprise ready solution to push the apps fast with maintainable code base and somewhat we could say later a de facto standard for building RIA on top of Silverlight.
Thanks
Khurram
R,

Nikhil Kothari

Posted on 4/23/2009 @ 8:17 AM
@Khurram -
I haven't looked at Cairngorm extensively, so if you have particular features that you think would be interesting it would be good to get into specifics. The reality is some things will probably show up (eg. MVC), while other things are already there, but in a way that fits with the rest of the framework and Silverlight (eg. commands, actions, view model etc.). .NET RIA Services addresses some other cross-tier aspects of the overall patterns and problem space.

The big thing I remember about Cairngorm in the demo I saw was the complete lack of simplicity (yes, that is in large part, a personal opinion). I'd like the framework to have a smooth ramp up on required understanding and complexity, and be usable in small chunks as opposed to requiring one to buy into everything to use any one bit.

Khurram

Posted on 4/28/2009 @ 7:51 AM
@Nikhil
I need to put some time in order to explore the RIA Services and then will be able to give some usefull input based on my experiences of RIA world.

I wont say that Cairngorm lacks simplicity but yes it has some "issues" which i 'll probably not discuss here because it'll be out of scope discussion. But to me, the Cairngorm is the
1 complete end to end framework which addresses all the issues in RIA world.
I'll probably port your Amazon store silverlight app to cairngorm and then will enhance it to a full fledge store aap. Untill I pass a number use cases implementations with a number
of different screens and views (with real life scenarios) untill then I wont be able to motivate my spec suggestions. To me the most important aspects of a large scale RIA are its extensibility, code maintainability and perhaps the simplicity too.
Thanks,
Khurram

Ivan Perez

Posted on 4/29/2009 @ 7:47 AM
Nikhil,

The one thing that I've seen with Silverlight and any domain objects that get proxied over in Silverlight is the loss of inherited types on the proxies. And so if I have a complex structure (and that is very hard to get away from; medical field) how would you recommend utilizing the domain objects in Silverlight? In other words, if I want to return a collection(Of DrugBase) but the contents of the collection are various types of drugs. On Silverlight, I lose the specific properties of the drug itself and only get thet base class. And vice versa, if I were to pass a Chemotherapy drug over, I lose the info that says this class is of DrugBase type... What do you recommend in overcoming this scenario? This could be a make or break for our next application in which avenue we take.

Nikhil Kothari

Posted on 4/30/2009 @ 9:47 PM
@Ivan - inheritance is an interesting scenario for some apps, but is likely to not fit our current v1 scope, simply in terms of addressing the more mainline scenarios first.

In terms of workarounds, it really depends on your specific types... the relatively speaking most straightforward thing is to create a union type that includes all properties, along with an additional field to track actual type each instance represents.

s

Posted on 5/9/2009 @ 7:25 AM
I appreciate your efforts with Silverlight FX, but I would like to know and learn RIA + MVVM without using any kind of framework. Although, I do commend you for all your work, and love reading your blogs, I still would like to see all the samples and guidance without the help of any custom framwork. I understand that using FX might simlify developer's life, but I do not want to depend on any framwork to get things done. Do you have any sample for that?

Simon

Posted on 5/13/2009 @ 10:56 AM
Hi Nikhil,
As you suggested, I wrote a PagingObjectProvider working in quite the same way as the DomainDataSource but not dependant on any technology (it uses reflection to bind itself on a ViewModel) : http://www.simonferquel.net/blog/archive/2009/05/12/silverlight-3-paging-with-ria-controls--m-v-vm-without-domaindatasource.aspx
I really like what we can achieve with this. It really fits well with my tesability requirements as it provides me a good way to isolate my views, ViewModels, and middle-tier layers on client-side (using Dependency Injection). Thank you very much for exposing the idea !

Nikhil Kothari

Posted on 5/13/2009 @ 2:58 PM
@s - MVVM is a pattern... and you need an implementation of the pattern to be productive and functional. Where the framework already provides infrastructure, namely binding, I haven't added framework there. Today, the framework doesn't provide infrastructure to hook up the view to its view model, or to invoke methods on the view model in response to events, or to allow a view model to handle events on a view model. Every sample can't build its own framework. The sample implementation would be overwhelmed with the custom implementation of each of these concepts.

@Simon - this is great to see... thanks for sharing the link. Its on my prototype list for possible inclusion into Silverlight.FX, and hopefully over time (no promises) make it into an official offering.

mitkodi

Posted on 5/21/2009 @ 1:12 AM
Nikhil,
Why EntityList fires EntityAdded and EntityRemoved events, but not an EntityEdited (at least I can't find similar event) and we must rely on events raised from UI elements (like DataGrid) to be notified when an entity in the list was modified?
Thanks!

Nikhil Kothari

Posted on 5/22/2009 @ 10:26 PM
@mitkodi -
Perhaps you could listen to the PropertyChanged event on the entity instance itself?

mitkodi

Posted on 5/25/2009 @ 8:28 AM
Actually, I was looking for a solution to be notified when EndEdit of an Entity instance from given EntityList is called. I thought it would be fine if EntityList could fire such event.

Devika V

Posted on 6/4/2009 @ 5:52 AM
Hi Nikhil,

I want to can we reuse the viewmodel created for RIA service in other application?
I tried by adding reference, but when i try to load the entities, it is throwing "Resource Not Found" exception.
Please suggest.

Regards
DV

mitkodi

Posted on 6/8/2009 @ 5:37 AM
@Nikhil, @Simon -
Definitely. I think we have to look at DomainDataSource as a part of ViewModel, not of View (and in this context it don't needed to be derived from Control).
Btw, then we won't have any problem requiring a DomainContext from it. What do you think about that?

Andres

Posted on 6/24/2009 @ 8:28 AM
Hi Nikhil,

Is it possible to use this views with Prism regions?

Regards,


Andrés

Steve

Posted on 7/23/2009 @ 7:38 AM
Hi Nikhil,

I am new to Silverlight, but am very excited in using the MVM pattern in conjunction with RIA.
The simple question I have is how do I get to use the silverlight Fx dll correctly. I have downloaded these and added as a reference in my project but cannot add a silverlight page like your SearchView.xaml, which has a .cs and .model.cs file associated, i.e. I can only add a standard xaml page.

Sorry if this is an obvious question to some.

Thanks

Steve

Steve

Posted on 7/23/2009 @ 7:40 AM
Hi Nikhil,

I am new to Silverlight, but am very excited in using the MVM pattern in conjunction with RIA.
The simple question I have is how do I get to use the silverlight Fx dll correctly. I have downloaded these and added as a reference in my project but cannot add a silverlight page like your SearchView.xaml, which has a .cs and .model.cs file associated, i.e. I can only add a standard xaml page.

Sorry if this is an obvious question to some.

Thanks

Steve

Adam

Posted on 8/17/2009 @ 9:19 AM
hey there,

Is there a way you can provided a version of your sample app that compiles/runs with the latest release of the toolkit and ria?

Thanks in advance!
Post your comment and continue the discussion.