Telerik RadGridView

Mar 3, 2011 at 8:29 PM

I am very new to Caliburn, and so far I am very impressed. I have run through the Coproject tutorial with success.

Now I am trying to adapt some of those processes to include the 3rd party controls we use at work. I am trying to use the message.attach in a RadGridView to open a details editor, but I can't figure out the correct $variable to pass.

I successfully trigger the method in the ViewModel, but no data from the view is passed in. For example I have added this to the RadGridView
cal:Message.Attach="[Event SelectionChanged]=[Action OpenItemDetail($dataContext)]"

public IEnumerable<IResult> OpenItemDetail(TeamMember item)
            if (item != null)
                var editor = Items.FirstOrDefault(x => x.Item.EmplID == item.EmplID);
                if (editor == null)
                    editor = IoC.Get<ITeamMemberDetail>();
                    yield return editor.Setup(item.EmplID).ToSequential();

                yield break;


I have also tried passing $this and $eventArgs with no success.

Any help would be appreciated.


Mar 4, 2011 at 8:14 AM
Edited Mar 4, 2011 at 8:15 AM

You can either:


1.) Change the signature of OpenItemDetail to pass in nothing and created a viewmodel property called SelectedTeamMember and two-way bind it to the SelectedItem property of the RadGridView, then simply use the value of SelectedTeamMember in your OpenItemDetail co-routine.


2.) Give your RadGridView an x:Name (such as TeamMembers) and pass in it's selected item property in your message attach: 

cal:Message.Attach="[Event SelectionChanged]=[Action OpenItemDetail(TeamMembers.SelectedItem)]"

Mar 4, 2011 at 2:19 PM

Thank you,

I used option 2 and it worked perfectly.