Dragging Status

4 posts, 0 answers
  1. Kirk
    Kirk avatar
    28 posts
    Member since:
    Jun 2012

    Posted 12 Mar 2012 Link to this post

    Is it possible with the TimeBar to tell when a user is dragging the selection around?

    I tried using the mouse down event but if you click on the selection bar it is not fired. What is handling this event? What part of the control captures the mouse when you do this?

    Also is there anyway to preview the StartSelection value while your moving the bar around?
  2. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 15 Mar 2012 Link to this post

    Hello Kirk,

    You can use the ActualSelectionStart and ActualSelectionEnd properties of the timeBar to get the selection values while the user is moving the selection element.

    Could you please explain in greater detail what you are trying to achieve? It will be best if you send me the code that you tried and did not work for you.

    All the best,
    Tsvetie
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
  3. DevCraft banner
  4. Kirk
    Kirk avatar
    28 posts
    Member since:
    Jun 2012

    Posted 15 Mar 2012 Link to this post

    Thank you for pointing out the ActualSelectionStart, I missed that somehow. That will make things nicer.

    Here is what I came up with for knowing when the dragging starts. Let me know if there is a better way.

    I had to pull out the SelectionThumb style and add events to the center handle to see when the drag started, changed, and ended.
    <Style x:Key="dragSelectionThumbStyle" TargetType="telerik:SelectionThumb">
        <Setter Property="Margin" Value="{StaticResource TimeBar_SelectionThumb_Margin}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="telerik:SelectionThumb">
                    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                        <Grid>
                            <Thumb x:Name="PART_CenterHandle" Style="{StaticResource SelectionRangeStyle}" DragStarted="PART_CenterHandle_DragStarted" DragDelta="PART_CenterHandle_DragDelta" DragCompleted="PART_CenterHandle_DragCompleted" />
                            <Thumb x:Name="PART_LeftHandle" HorizontalAlignment="Left" Style="{StaticResource SelectionThumbHandleStyle_Flipped}" />
                            <Thumb x:Name="PART_RightHandle" HorizontalAlignment="Right" Style="{StaticResource SelectionThumbHandleStyle}" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
  5. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 16 Mar 2012 Link to this post

    Hello Kirk,

    The solution you came up is actually what I had in mind. Thank you for sharing it with us.

    All the best,
    Tsvetie
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top