views:

104

answers:

2

Silverlight FX looks like it will cover my MVVM needs, however I'm struggling to find good documentation on the behaviors system (or any good doco) beyond some blog posts which are from previously released versions.

Specifically, I am trying to figure out how I can capture a RowCommit event from my view and have it invoke a method/event on my view model? I am trying to capture this event from the ComponentOne datagrid, but there is nothing in the framework than indicates it wont work with third party controls.

Any ideas?

+1  A: 

There is no documentation available that I am aware of. I was able to learn the most by looking at the C# source files provided in the download and the various articles that the author wrote on his blog. Looking at the source code of the samples that the author provides also helped.

DaveB
Thanks, getting stuck directly into the source code is proving quite useful.
Alex
+1  A: 

I do really need to write up some docs... partly hoping a reference sample will help just as well. Do look at the sample apps - they're all compiled/working, and demonstrate a variety of scenarios.

Your specific question... note I haven't seen/used that particular vendor's control... but some educated guess:

<componentOne:DataGrid>
  <fxui:Interaction.Triggers>
    <fxui:EventTrigger EventName="RowCommit" Action="$model.SomeMethodOnViewModel()" />
  </fxui:Interaction.Triggers>
</componentOne:DataGrid>

You can pass in data from eventargs - for example, if EventArgs contains a reference to the Row which contains a reference to a model item just committed, you might be able to refer to it with $eventArgs.Row.DataContext and pass that in into the SomeMethodOnViewModel.

Hope that helps.

NikhilK
Thanks NikhilK i'll try that. Just some comments on my experience with the sample apps: 1.) All but one of the sample apps that hit external services fail for me. No exceptions, they just sit with a progress bar and never return results. It could be some problem at my end, my point is that external services creates more surface area for potential errors. This is not great for when you are trying to learn.
Alex
2.) I couldnt see much in the sample apps that illustrates communication between view models (Or is SilverlightFX not designed for that scenario...should I be looking at Prism?) It would be valuable for me to see a sizable sample app that featured multiple widgets (that could be dynamically created) and their interactions.
Alex
Appreciate the comments - I should at least add a readme indicating which services are hit, what API keys are needed, and where in web.config they must be specified.With regards to VM communication, Silverlight.FX has an event aggregator. Its a new feature that I haven't yet published a sample for. If you look for IEventAggregator, you'll see it has a simple pub/sub API.
NikhilK
I guess I just saw it as a distraction given that fiddling with Amazon keys was not helping me understand MVVM or the FX framework. Anyway, with regards to my actual question - the approach you suggested worked. Thanks.
Alex