MVVM Ready?

4 posts, 0 answers
  1. Derek
    Derek avatar
    3 posts
    Member since:
    Jul 2011

    Posted 11 Aug 2011 Link to this post

    Is it possible to use this control with MVVM?  I don't think it's possible but figured I would ask the experts.  Thanks.
  2. Viktor Tsvetkov
    Admin
    Viktor Tsvetkov avatar
    382 posts

    Posted 12 Aug 2011 Link to this post

    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 >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Ilya
    Ilya avatar
    3 posts
    Member since:
    May 2013

    Posted 20 May 2013 Link to this post

    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.
  5. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 23 May 2013 Link to this post

    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.

Back to Top