whihathac
whihathac

Reputation: 1761

How to expose commands for a Hyperlink button in Silverlight Telerik Radgrid

To give you background, i am using Silverlight + MVVM and PRISM.

I have some Master data to show in grid and have the first column as hyperlink to the detail data. I am trying to expose some command for a Hyperlink button, but it doesnt seem to work fine.

Here's my XAML ->

            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Detail ID">
                    <telerik:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <HyperlinkButton Content="{Binding DetailID}" 
                                             Command="{Binding SelectGridItemCommand}" 
                     CommandParameters={Binding}
                                             />
                        </DataTemplate>
                    </telerik:GridViewColumn.CellTemplate>
                </telerik:GridViewDataColumn>

        ... [other columns]

</<telerik:RadGridView.Columns>

Basically, I want to do some processing on the text that is present on the Column name and navigate to the detail page.

Can someone help me here..

Upvotes: 2

Views: 2840

Answers (2)

whihathac
whihathac

Reputation: 1761

I found what I was doing wrong. I had bound an Model object in the viewModel to the Grid and when I wrote the binding command in ViewModel, i dint specify that it needs to change the data context to my viewmodel.

Anyways I eventually wrote an delegate and exposed an event in the Model class and subscribed to that event in the ViewModel where I handled it with my custom EventHandlerArgs.

Upvotes: 2

Paulo
Paulo

Reputation: 172

With Caliburn Micro the binding is seamless, if you name control, let's say 'SelectDetail', the adjacent ViewModel's method should be named SelectDetail as well. Evenmore, if you create a boolean property named as CanSelectDetail there will be an 'automagic' binding to IsEnabled Hyperlikn's property

Upvotes: -1

Related Questions