Unpinned pane: Trying to hook up MouseMove handler

5 posts, 0 answers
  1. Charles Bates
    Charles Bates avatar
    45 posts
    Member since:
    Feb 2010

    Posted 07 Nov 2012 Link to this post

    Hello,
    Telerik.Windows.Controls.Docking.dll  v2.0.50727

    We have a UserControl in a RadPane:
                                

    <dock:RadPane x:Name = "tagPalettePane"
         Header = "Tag Palette" CanUserClose = "False"  = "180" ="{x:Null}" >
             <ScrollViewer VerticalScrollBarVisibility = "Auto">
                 <Views:TagManagerView x:Name = "viewTagManager" />
             </ScrollViewer>
    </dock:RadPane>

    The TagManagerView contains an MS Toolkit  TreeView control; the TreeViewItems are described in a template:
    <sdk:TreeView.ItemTemplate>
        <sdk:HierarchicalDataTemplate ItemsSource="{Binding Children}">
            <Border x:Name="TreeItemBorder"
                VerticalAlignment="Stretch"
                HorizontalAlignment="Stretch"
                MouseLeftButtonDown="TreeItemBorder_MouseLeftButtonDown"
                MouseLeftButtonUp="TreeItemBorder_MouseLeftButtonUp">
                <StackPanel Orientation="Horizontal">
                    <CheckBox  IsChecked="{Binding IsVisible, Mode=TwoWay}"></CheckBox>
                    <TextBlock x:Name = "TagTextBlock"  Text="{Binding Name}" Foreground="{Binding TagType, Converter={StaticResource colorConverter}}"
                                MouseEnter = "TagTextBlock_OnMouseEnter"
                                MouseLeave="TagTextBlock_MouseLeave"
                                  />
                </StackPanel>
            </Border>
        </sdk:HierarchicalDataTemplate>
    </sdk:TreeView.ItemTemplate>
    TreeItemBorder_MouseLeftButtonDown hooks up a MouseMove event handler:
        LayoutRoot.MouseMove += DragTagDelta;
    (LayoutRoot is a Grid control in our content display area.

    Finally the question/problem:  
    - When the RadPane is pinned open, the DragTagDelta handler is called.  
    - When the RadPane is NOT pinned open, the code that hooks up the DragTagDelta handler is called, but DragTagDelta is never called.

    Why is that, and how can I fix it?
    Thanks for any insight...






  2. Charles Bates
    Charles Bates avatar
    45 posts
    Member since:
    Feb 2010

    Posted 07 Nov 2012 Link to this post

    I have a VS2010 solution that demonstrates the problem, but can't find a way to attach it.  (Renaming the .zip as .png seemed to not work...)

  3. Download a free trial of UI for WPF
  4. Vladi
    Admin
    Vladi avatar
    676 posts
    Member since:
    Dec 2014

    Posted 12 Nov 2012 Link to this post

    Hello Charles,

    It seems that there is an issue with the event binding in your project. When a RadPane is unpinned its content gets put in a ToolTip which may be causing your event handler not to be found.

    The next code snippet shows how to call a UserControl event placed in a RadPane:
    in the xaml of the MainPage:

    <telerik:RadDocking>
        <telerik:RadSplitContainer>
            <telerik:RadPaneGroup>
                <telerik:RadPane Header="Pane 1">
                    <local:MyUserControl/>
                </telerik:RadPane>
            </telerik:RadPaneGroup>
        </telerik:RadSplitContainer>
    </telerik:RadDocking>

    the xaml of custom UserControl:
    <StackPanel x:Name="LayoutRoot" Orientation="Vertical" Background="White" MouseMove="LayoutRoot_MouseMove_1">
        ...
    </StackPanel>

    and in the code behind of the UserControl:
    private void LayoutRoot_MouseMove_1(object sender, MouseEventArgs e)
    {

    }

    On a side note you can only attach images in forum posts, attaching projects can be done in private support tickets only.

    All the best,
    Vladi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  5. Charles Bates
    Charles Bates avatar
    45 posts
    Member since:
    Feb 2010

    Posted 12 Nov 2012 Link to this post

    Thanks for the reply,  However, we don't want to handle the MouseMove event on the UserControl, but on each TreeViewItem.  (The TreeViewItems are described in an ItemTemplate.)   We hook up the MouseMove event programmatically when the TreeItem_MouseLeftButtonDown event is handled.  
    (Due to the unrelated controls involved, it is somewhat convoluted in getting a drag cursor hooked up and the MouseMove handler hooked up.)
    Appreciate the help...

  6. Vladi
    Admin
    Vladi avatar
    676 posts
    Member since:
    Dec 2014

    Posted 15 Nov 2012 Link to this post

    Hi Charles,

    As we see that this is a somewhat complicated scenario which we cannot reproduce at our side could you open a support ticket and send us a runnable project that recreates the issue in order for us to assist you accordingly.

    Other then that we cannot assist you if we cannot reproduce the issue on our side.

    All the best,
    Vladi
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top
Download a free trial of UI for WPF