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

RadTileList - Clicking on RadTileList without selecting a tile

4 Answers 21 Views
TileList
This is a migrated thread and some comments may be shown as answers.
Kermit
Top achievements
Rank 1
Kermit asked on 16 Jul 2019, 07:36 PM
Hello Everyone,

I have users that can have 30 tiles on the RadTileList

I am trying to detect when the RadTileList is selected. Not the tiles inside the RadTileList.

The goal her, is to send the user back to the search textbox in the RadToolBar at the top.

I can't use  RadTileList_SelectionChanged since is not fired when not selecting a tile.

FocusManager.FocusedElement="{Binding ElementName=txtSearch}" doesn't work

and FocusManager.GotFocus="radTileLis_Focus" works once even if you click on a tile.

Is it possible to do that?

If so how?

4 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar Dinev
Telerik team
answered on 19 Jul 2019, 03:19 PM
Hi,

Thank you for the description.

You can achieve this by adding a new handler for RadTileList's MouseLeftButtonDownEvent and check if the item under the mouse cursor on click is a Tile. Check the example below:

public MainWindow()
        {
            InitializeComponent();
            this.tileList.AddHandler(RadTileList.MouseLeftButtonDownEvent, new
MouseButtonEventHandler(TileList_MouseLeftButtonDown), true);
        }
 
private void TileList_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
   {
       object tile = e.OriginalSource as Tile ?? ((FrameworkElement)e.OriginalSource).ParentOfType<Tile>();
       if (tile == null)
        {
            // You clicked over an empty area. No tile is clicked.
            this.textBox.Focus();
            this.textBox.SelectAll();
        }
    }

Attached, you can find a sample project in which I demonstrate this approach. Please, review it and let me know if that answers your question.

Regards,
Dimitar Dinev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Kermit
Top achievements
Rank 1
answered on 22 Jul 2019, 01:12 PM

Hi,
It work's!

Thanks for the help!

 

Before writing to the forum, hi tried the MouseLeftButtonDown event handler by defining it in the xaml.

But it didn't quiet work's like expected. The event was fired only once.

Is their any difference between the two ways?

 

 

0
Dimitar Dinev
Telerik team
answered on 23 Jul 2019, 01:43 PM
Hi,

The difference is when using a routed event handler, you specify the handledEventsToo argument to true while defining in Xaml, it'll be a default value of false. This means that the handler will be invoked even for events that had already been marked as handled.

Please, let me know if that answers your question.

Regards,
Dimitar Dinev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Kermit
Top achievements
Rank 1
answered on 24 Jul 2019, 03:20 PM

It does.

 

Thank you,

Tags
TileList
Asked by
Kermit
Top achievements
Rank 1
Answers by
Dimitar Dinev
Telerik team
Kermit
Top achievements
Rank 1
Share this question
or