This is a migrated thread and some comments may be shown as answers.

MVVM Ready?

3 Answers 269 Views
BreadCrumb
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 11 Aug 2011, 11:33 PM
Is it possible to use this control with MVVM?  I don't think it's possible but figured I would ask the experts.  Thanks.

3 Answers, 1 is accepted

Sort by
0
Viktor Tsvetkov
Telerik team
answered on 12 Aug 2011, 01:02 PM
Hi Derek,

Could you please examine this help article, see the online demos and if you have further questions feel free to ask?

All the best,
Viktor Tsvetkov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Ilya
Top achievements
Rank 1
answered on 20 May 2013, 09:30 AM
Hi.

I am trying to use Breadcrumb with MVVM pattern now and I am a bit stuck with handling SelectionChanged event. Could you provide just a small example how should I bind event to the ViewModel code?

I have tried this code:
<telerik:RadBreadcrumb x:Name="Breadcrumb" <br><span class="Apple-tab-span" style="white-space:pre">        </span>...                               <br>            ><br>            <i:Interaction.Triggers><br>                <i:EventTrigger EventName="SelectionChanged"><br>                    <i:InvokeCommandAction Command="{Binding SelectedItemChangedCommand}"/><br>                </i:EventTrigger><br>            </i:Interaction.Triggers><br>            <br>        </telerik:RadBreadcrumb>


And in ViewModel:
private void BreadcrumbItemChangedCommandFunction()<br>        {<br>            int i = 1;<br>        }<br><br>        private void CreateCommands()<br>        {<br>            SelectedItemChangedCommand = new DelegateCommand(BreadcrumbItemChangedCommandFunction, CanRunChange);<br>        }<br><br>        private bool CanRunChange()<br>        {<br>            return true;<br>        }<br><br>        public DelegateCommand SelectedItemChangedCommand { get; set; }


Haven't ever came to "int i =1;"

Thank you for help.
0
Zarko
Telerik team
answered on 23 May 2013, 09:11 AM
Hello Ilya,
Instead of SelectionChanged you should use the CurrentItemChanged event like this:
<i:EventTrigger EventName="CurrentItemChanged">
    ...
</i:EventTrigger>
Also if you want you could bind the current item and use it in the command like this:
<telerik:RadBreadcrumb x:Name="Breadcrumb" CurrentItem="{Binding MyCurrentItem}">
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="CurrentItemChanged">
            <i:InvokeCommandAction Command="{Binding SelectedItemChangedCommand}"
                            CommandParameter="{Binding MyCurrentItem}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
</telerik:RadBreadcrumb>
I hope I was able to help you and if you have further questions please feel free to ask.

Regards,
Zarko
Telerik

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
BreadCrumb
Asked by
Derek
Top achievements
Rank 1
Answers by
Viktor Tsvetkov
Telerik team
Ilya
Top achievements
Rank 1
Zarko
Telerik team
Share this question
or