MouseLeftButtonDown event Problem with radtileview

2 posts, 0 answers
  1. javier
    javier avatar
    13 posts
    Member since:
    Mar 2011

    Posted 15 Apr 2011 Link to this post

    Hi,
    I have a grid that contains in one row a RadTileView control. i set a MouseLeftButtonDown event to the grid but when i make a click in the tileview area it does not shoot. Then i put the same event in the RadTileView control but did not work neither.
    When i put the event on the tleviewItem it works correctly but what i need is to start this event when somebody click in an empty area.
    Any solutions to this?
    Sry for my english.
    Greetings.
  2. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 19 Apr 2011 Link to this post

    Hi javier,

     The problem is that the RadTileView handles the MouseLeftButtonDown event. If you want to be able to handle it too you'll have to add a handler for it in code behind like this:

    this.AddHandler(MouseLeftButtonDownEvent, new MouseButtonEventHandler(OnClick), true);
    And in the OnClick method you can check if the click was inside some of the RadTileViewItems by checking if the original source has a parent of type RadTileViewItem like this:
    private void OnClick(object sender, MouseButtonEventArgs e)
    {
        var originalSource = e.OriginalSource as FrameworkElement;
        this.click.Text = (originalSource.ParentOfType<RadTileViewItem>() == null).ToString();
    }
    I've attached a sample project with this behavior and if you need further assistance feel free to ask.


    All the best,
    Zarko
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top