Deselecting Tiles

2 posts, 0 answers
  1. Mike
    Mike avatar
    28 posts
    Member since:
    Apr 2013

    Posted 29 May 2015 Link to this post

    I've been using the RadTileList for a while and I've not noticed this behaviour with the previous releases (thought I may have just not noticed). However I'm really struggling to deselect a tile after a user clicks on it.

    In my main app when a user selects a tile it normally triggers a change to the viewmodel and another view is presented. When I then go back to the main view no tiles are selected, which is as desired.

    But I have a tile that triggers a background process, spawns another window and makes the tile disabled. It still show selected though. When the process finishes the tile is enabled again, but it's still selected. The enable/disable is done by a viewmodel binding, so it's all automatic.

    In my app I've just been setting the SelectedItem to null and it's appeared to behave how I want. I've just created a brand new project and tried to get the deselection working in isolation and I just cannot get it to deselect. 

     This is the WPF:

    <telerik:RadTileList HorizontalAlignment="Left" Margin="105,113,0,0" VerticalAlignment="Top" SelectionChanged="RadTileList_SelectionChanged">
        <telerik:Tile x:Name="TileA" Background="#FFC71D1D">
            <TextBlock Text="Tile A"/>
        </telerik:Tile>
     
        <telerik:Tile x:Name="TileB" Background="#FF3FB812">
            <TextBlock Text="Tile B"/>
        </telerik:Tile>
        <telerik:Tile x:Name="TileC" Background="#FF2439BF">
            <TextBlock Text="Tile C"/>
        </telerik:Tile>
    </telerik:RadTileList>

     This is the code in the .cs file: 

    private void RadTileList_SelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        if (e.AddedItems.Count > 0)
        {
     
            var theTiles = sender as RadTileList;
     
            if (theTiles.SelectedItem == TileA)
            {
                //do some stuff here
            }
     
            if (theTiles.SelectedItem == TileB)
            {
                //do some stuff here
            }
     
            theTiles.SelectedItem = null;               
        }
    }

     

    In my app the tile just doesn't get deselected, but in this demo I end up in an infinite loop, where the SelectionChanged event is constantly triggered.

    I figure I must be doing something pretty wrong for this not to work.

    Any clues? or indeed how I should automatically deselect the item?

    BTW: I've looked at removing the styling for the selection, but it is still actually selected so the user has to click several times for it to silently deselect then select again, which isn't desirable.

     

     

     

     

     

     

     

     

  2. Maya
    Admin
    Maya avatar
    4062 posts

    Posted 03 Jun 2015 Link to this post

    Hello Mike,

    Actually, it is a know issue that has been logged in our system. I raised its priority so that it gets fixed sooner. You can follow its progress in our Feedback Portal

    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
Back to Top