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

My MouseLeftButtonDown does not work at all?

1 Answer 36 Views
Slider
This is a migrated thread and some comments may be shown as answers.
Zinc Deng
Top achievements
Rank 1
Zinc Deng asked on 24 Mar 2010, 03:56 AM

I updated the control to  2010 Q1 and also met this problem
My MouseLeftButtonDown does not work at all!

xaml code is as following:
<UserControl x:Class="CoachStation.test_Slider"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml
    xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls"
    Width="400" Height="300">
    <Grid x:Name="LayoutRoot" Background="White">
        <telerik:RadSlider SmallChange="1" x:Name="sdr_timeLine" Grid.Column="0" Grid.Row="0"  Width="710" MouseLeftButtonDown="sdr_timeLine_MouseLeftButtonDown"  MouseLeftButtonUp="sdr_timeLine_MouseLeftButtonUp"></telerik:RadSlider>
    </Grid>
</UserControl>

cs code is as following:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace CoachStation
{
    public partial class test_Slider : UserControl
    {
        public test_Slider()
        {
            InitializeComponent();
        }

        private void sdr_timeLine_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            MessageBox.Show("down");
        }

        private void sdr_timeLine_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            MessageBox.Show("up");
        }
    }
}

1 Answer, 1 is accepted

Sort by
0
Kiril Stanoev
Telerik team
answered on 24 Mar 2010, 11:05 AM
Hi Zinc Deng,

Thank you for your feedback. This is expected behavior, since general guidelines state that if a certain control is doing something after a user-triggered action, the the event should be handled. If you still want to use the MouseLeftButtonDown event, you can add a handler as shown bellow:

public MainPage()
{
    InitializeComponent();
    sdr_timeLine.AddHandler(FrameworkElement.MouseLeftButtonDownEvent, new MouseButtonEventHandler(sdr_timeLine_MouseLeftButtonDown), true);
}
 
private void sdr_timeLine_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
    if (e.OriginalSource is Rectangle)
    {
        MessageBox.Show("down");
    }
}

Let us know how this works for you.

Regards,
Kiril Stanoev
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.
Tags
Slider
Asked by
Zinc Deng
Top achievements
Rank 1
Answers by
Kiril Stanoev
Telerik team
Share this question
or