tags:

views:

55

answers:

1

i have a simple custom control that derives from UserControl with the following XAML:

<UserControl x:Class="EMS.Controls.Dictionary.MapTip"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
       xmlns:slData="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
       xmlns:infrv="clr-namespace:OCC600.Infrastructure.Interface.Views;assembly=EMS.OCC600.Infrastructure.Interface"
        xmlns:igDP="http://infragistics.com/DataPresenter"       x:Name="root"                   
      > 

    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Resources/Styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Viewbox x:Name="viewBox" >
        <Border CornerRadius="10" Background="#80000000" BorderBrush="Black">                 
            <Grid Name="contentGrid" Margin="0,20,0,0" >            
                <Grid.RowDefinitions>              
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>                   
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>                  
                </Grid.ColumnDefinitions>              

                <Border Grid.Row="2" Margin="5" Grid.ColumnSpan="2" Visibility="Visible" >                                                  
                    <igDP:XamDataGrid Margin="5"                                      
                                      Name="IdentifyDetailsDataGrid"     
                                      Style="{StaticResource readonlyGrid}"  
                                      ClipToBounds="False">                        
                        <igDP:XamDataGrid.FieldLayoutSettings>
                            <igDP:FieldLayoutSettings                         
                                AutoGenerateFields="True"                                                                                                                                   
                                HighlightAlternateRecords="True"                                
                                FilterUIType="LabelIcons"
                                AllowAddNew="False" 
                                AllowDelete="False"                                                                 
                                SelectionTypeCell="Single"                                
                                SelectionTypeField="Single"                        
                                />
                        </igDP:XamDataGrid.FieldLayoutSettings>
                        <igDP:XamDataGrid.FieldSettings>
                            <igDP:FieldSettings
                                LabelClickAction="SortByOneFieldOnly"                                 
                                AllowEdit="False" 
                                AllowGroupBy="True"                                 
                                CellClickAction="SelectRecord"                            
                                ExpandableFieldRecordHeaderDisplayMode="NeverDisplayHeader"/>
                        </igDP:XamDataGrid.FieldSettings>
                    </igDP:XamDataGrid>                    
                </Border>          
        </Grid>   
        </Border>
    </Viewbox>  
</UserControl>

An instance of this Maptip is added to the DragCanvas provided by JSmith here: http://www.codeproject.com/KB/WPF/DraggingElementsInCanvas.aspx

This control is dynamically provided a toolbar with buttons bound to commands in a ViewModel. When I click on the buttons, nothing happens. However, if I replace the base class of Maptip with System.Windows.Primitives.Popup class, buttons respond to mouse click event events and commands are executed, when this maptip is added to the drag canvas.

Any hints on what I am seeing here?

TIA.

A: 

Had to do with custom DragConvas overriding OnPreviewMouseLeftButtonDown. Changed to override OnMouseLeftButtonDown instead and my control does see mouse clicks now. Got clue from link:

http://www.codeproject.com/KB/WPF/DraggingElementsInCanvas.aspx

e28Makaveli