Binding IsSelected Property for Tile in MVVM

4 posts, 1 answers
  1. sandeep
    sandeep avatar
    6 posts
    Member since:
    Jun 2014

    Posted 04 Feb Link to this post

    Hi, 

     Is there an option of binding IsSelected Property for the Tile In MVVM for each of the item in list that is binded to RadTileList Control/

    I am using Autogenerating tiles for the RadTileList Control.

     

    Thanks,

    Sandeep Kumar Vidiyala

  2. Answer
    Maya
    Admin
    Maya avatar
    4062 posts

    Posted 04 Feb Link to this post

    Hi Sandeep,

    You can bind the IsSelected property of the tile directly in the event as follows:
    private void OnAutoGeneratingTile(object sender, AutoGeneratingTileEventArgs e)
            {
                e.Tile.SetBinding(Tile.IsSelectedProperty, new Binding("IsSelected"){Mode = BindingMode.TwoWay});
            }

    Attached is a small sample project illustrating the behavior.

    Regards,
    Maya
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. sandeep
    sandeep avatar
    6 posts
    Member since:
    Jun 2014

    Posted 04 Feb in reply to Maya Link to this post

    Hi Maya,

     

    Thanks for your reply. 

    Is this the only way or is there any option for binding in xaml.

     

    Thanks,

    Sandeep Kumar Vidiyala

     

  5. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 04 Feb Link to this post

    Hello Sandeep,

    You can create a simple style as this one:
    <Style TargetType="telerik:Tile">
                <Setter Property="IsSelected" Value="{Binding IsSelected}" />
            </Style>

    If you are working with NoXaml binaries, don't forget to set BasedOn property.

    Regards,
    Maya
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top