none
Problem With PreviewKeyUp

    Question

  • I have WPF user interface with a search text box and a grid which is part of a UserControl. I've defined a PreviewKeyUp-event handler for the grid and another PreviewKeyUp-event handler for the text box. The idea behind this is, that if the focus is on my text box and I press ENTER, a search in the grid should be performed. If I've selected a row in my grid and the focus is not on the text box, a dialog with the details of the record should be displayed.

    Unfortunately the program does not behave in this way. Even if I'm writing something in the textbox and then press ENTER, the event handler of the grid is called. If I look at the parameters the sender is the grid although the focus was on the text box.

    I probably don't understand how the PreviewKeyUp events work. Perhaps someone has an idea why this does not work as expected.

    I appreciate every reply.

    Markus

    P.S. I made a further test: I implemented a PreviewKeyUp event handler on the window and checked the focus using Keyboard.FocusedElement. Even if I write something in my text box see the I-beam, FocusedElement references my grid! I'm puzzled.

     

     

     

    Wednesday, March 17, 2010 8:41 PM

All replies

  • It would be helpful if you could show the xaml where you define the textbox, grid and where you hookup the event handlers.
    Wednesday, March 17, 2010 11:19 PM
  • Markus,

    It sounds like that the TextBox is inside the Grid.  PreviewKeyUp is a "Tunneling" routed event which means that the event starts at the root element, most likely the Window, and starts tunneling into each element on the window looking for events that handle it.  If you mark the routed event as handled = true, the tunneling will stop at that element else it will keep tunneling until it finds the next element that handles the event. 

    So if the TextBox is inside the Grid, the Grid PreviewKeyUp will be hit first and then the TextBox PreviewKeyUp will be hit.  If you move the TextBox out of the Grid, it should solve your problem.

    Check out this for further explaination.  http://msdn.microsoft.com/en-us/library/ms742806.aspx#routing_strategies

    Ken
    Thursday, March 18, 2010 4:29 AM
  • Hi Shreedhar

    There are two XAML files involved.  One is for the main screen which contains the edit control named  "TextBoxSearch". It further contains a container used to which is filled with tabs including the UserControl (The creation of the tabs is done in code behind). The UserControl hold a grid.
    The second XAML file is that of the UserControl called BaseContentControl. It includes the grid named "xamMainDataGrid". In both XAML file most of the controls used, are third party controls by Infragistics.

    I've implemented two handlers for the PreviewKeyUp event. One for the text box (textBoxSearch_PreviewKeyUP) and one for the grid (xamMainDataGrid_PreviewKeyUp). For testing I also implemented a third one namely on the main window (Window_PreviewKeyUp).  In each of the three event handlers I always get the grid as the event source (even if I'm inside the text box). The event handler for the text box never gets fired.

    I hope my description is understandable. Below you find the two XAML files.

    Best Regards

    Markus




    Main Window XAML Code:

    <Window x:Class="WeyPartsUserInterface.MainScreen" Icon="Images/WeyLogo16x16.gif"
    
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    
    Title="Wey Parts" Height="1024" Width="1280" xmlns:igRibbon="http://infragistics.com/Ribbon" xmlns:igDock="http://infragistics.com/DockManager" xmlns:igDP="http://infragistics.com/DataPresenter"
    
    Loaded="Window_Loaded" xmlns:igEditors="http://infragistics.com/Editors" PreviewKeyUp="Window_PreviewKeyUp">
    
    <Grid Name="Grid1" >
    
    <Grid.RowDefinitions>
    
    <RowDefinition Height="150" />
    
    <RowDefinition Height="*" />
    
    <RowDefinition Height="50" />
    
    </Grid.RowDefinitions>
    
    <igRibbon:XamRibbon HorizontalAlignment="Stretch" Name="xamRibbonMainScreen" VerticalAlignment="Top" Grid.Row="0">
    
    <igRibbon:RibbonTabItem Header="Main" Name="RibbonTabItemToolbar1">
    
    <igRibbon:RibbonGroup Caption="New Window" HorizontalAlignment="Left" Name="RibbonGroupNewWindow" >
    
    <igRibbon:ButtonTool Caption="Components" SmallImage="Images/NewWindow3.gif" Name="ButtonNewComponentsWindows" Click="ButtonNewComponentsWindows_Click" />
    
    <igRibbon:ButtonTool Caption="Prints" SmallImage="Images/NewWindow2.gif" Name="ButtonNewPrintsWindows" Click="ButtonNewPrintsWindows_Click" />
    
    <igRibbon:ButtonTool Caption="Products" SmallImage="Images/NewWindow1.gif" Name="ButtonNewProductsWindows" Click="ButtonNewProductsWindows_Click" />
    
    <igRibbon:ButtonTool Caption="Production" SmallImage="Images/NewWindow4.gif" Name="ButtonNewProductionWindows" Click="ButtonNewProductionWindows_Click" />
    
    <igRibbon:ButtonTool Caption="Stock Mov." SmallImage="Images/NewWindow6.gif" Name="ButtonNewStockMovementWindow" Click="ButtonNewStockMovementWindow_Click" />
    
    <igRibbon:ButtonTool Caption="Understock" SmallImage="Images/NewWindow5.gif" Name="ButtonNewUnderstockWindow" Click="ButtonNewUnderstockWindow_Click" />
    
    <igRibbon:ButtonTool Caption="Orders" SmallImage="Images/NewWindow6.gif" Name="ButtonNewOrdersWindow" Click="ButtonNewOrdersWindow_Click" />
    
    <igRibbon:ButtonTool Caption="Distributors" SmallImage="Images/NewWindow6.gif" Name="ButtonNewDistributorsWindow" Click="ButtonNewDistributorsWindow_Click" />
    
    <igRibbon:ButtonTool Caption="Currencies" SmallImage="Images/NewWindow6.gif" Name="ButtonNewCurrenciesWindow" Click="ButtonNewCurrenciesWindow_Click" />
    
    </igRibbon:RibbonGroup>
    
    <igRibbon:RibbonGroup Caption="Edit" HorizontalAlignment="Left" Name="RibbonGroupEdit" >
    
    <Grid>
    
    <Grid.ColumnDefinitions>
    
    <ColumnDefinition />
    
    <ColumnDefinition />
    
    </Grid.ColumnDefinitions>
    
    <Grid.RowDefinitions>
    
    <RowDefinition />
    
    <RowDefinition />
    
    <RowDefinition />
    
    </Grid.RowDefinitions>
    
    <igRibbon:ButtonTool Grid.Column="0" Grid.Row="0" Caption="New" SmallImage="Images/NewItem.gif" Name="ButtonNewItem" Click="ButtonNewItem_Click" />
    
    <igRibbon:ButtonTool Grid.Column="0" Grid.Row="1" Caption="Clone" SmallImage="Images/CloneItem.gif" Name="ButtonCloneItem" Click="ButtonCloneItem_Click" />
    
    <igRibbon:ButtonTool Grid.Column="1" Grid.Row="0" Caption="Edit" SmallImage="Images/Edit16NG.gif" Name="ButtonEditItem" Click="ButtonEditItem_Click" />
    
    <igRibbon:ButtonTool Grid.Column="1" Grid.Row="1" Caption="Del" SmallImage="Images/DeleteItem.gif" Name="ButtonCutItem" Click="ButtonCutItem_Click" Visibility="Visible" />
    
    <igRibbon:ButtonTool Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" Caption="New Production" SmallImage="Images/NewItem.gif" Name="ButtonNewProduction" Click="ButtonNewProduction_Click" />
    
    </Grid>
    
    </igRibbon:RibbonGroup>
    
    <igRibbon:RibbonGroup Caption="Print" Name="RibbonGroupPrint" >
    
    <igRibbon:ToolVerticalWrapPanel>
    
    <igRibbon:ButtonTool Caption="Print" SmallImage="Images/Print16x16.gif" Name="ButtonPrint" Click="ButtonPrint_Click" />
    
    <igRibbon:ButtonTool Caption="Preview" SmallImage="Images/PrintPreview16x16.gif" Name="ButtonPrintPreview" Click="ButtonPrintPreview_Click" />
    
    <igRibbon:ButtonTool Caption="Export" SmallImage="Images/Excel.gif" Name="ButtonExcelExport" Click="ButtonExcelExport_Click" />
    
    </igRibbon:ToolVerticalWrapPanel>
    
    </igRibbon:RibbonGroup>
    
    <igRibbon:RibbonGroup Caption="Search / Filter" Name="RibbonGroupSearch">
    
    <Grid >
    
    <Grid.RowDefinitions>
    
    <RowDefinition />
    
    <RowDefinition />
    
    <RowDefinition />
    
    </Grid.RowDefinitions>
    
    <Grid.ColumnDefinitions>
    
    <ColumnDefinition />
    
    <ColumnDefinition />
    
    </Grid.ColumnDefinitions>
    
    <igRibbon:ButtonGroup Grid.Column="0" Grid.ColumnSpan="2">
    
    <igRibbon:TextEditorTool Caption="Search:" Name="TextBoxSearch" PreviewKeyUp="TextBoxSearch_PreviewKeyUp" KeyUp="TextBoxSearch_KeyUp" />
    
    <igRibbon:ButtonTool SmallImage="Images/Search16NG.gif" Name="ButtonSearch" Click="ButtonSearch_Click" />
    
    </igRibbon:ButtonGroup>
    
    <igRibbon:ButtonTool Grid.Column="0" Grid.Row="1" Caption="Clear Search" SmallImage="Images/ClearSearch16NG.GIF" Name="ButtonClearSearch" Click="ButtonClearSearch_Click" />
    
    <igRibbon:ButtonTool Grid.Column="1" Grid.Row="1" Caption="Refresh" SmallImage="Images/Refresh 16 n p.png" Name="ButtonRefresh" Click="ButtonRefresh_Click" />
    
    <igRibbon:ToggleButtonTool Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" Id="ToggleButtonRowFilteringOnOff" Caption="Enable Row Filtering" Name="ToggleButtonRowFilteringOnOff" SmallImage="Images/Filter16x16.gif" Checked="ToggleButtonRowFilteringOnOff_Checked" Unchecked="ToggleButtonRowFilteringOnOff_Unchecked" />
    
    </Grid>
    
    </igRibbon:RibbonGroup>
    
    <igRibbon:RibbonGroup Caption="Components Filter" Name="RibbonGroupFilterComponents" >
    
    <igRibbon:ButtonGroup Name="CAD">
    
    <igRibbon:CheckBoxTool Id="CheckBoxOnlyCAD" Caption="only CAD" Name="CheckBoxOnlyCAD" Checked="CheckBoxOnlyCAD_Checked" Unchecked="CheckBoxOnlyCAD_Unchecked" />
    
    <igRibbon:CheckBoxTool Id="CheckBoxOnlyNotCAD" Caption="only Not CAD" Name="CheckBoxOnlyNotCAD" Checked="CheckBoxOnlyNotCAD_Checked" Unchecked="CheckBoxOnlyNotCAD_Unchecked" />
    
    </igRibbon:ButtonGroup>
    
    <igRibbon:ButtonGroup Name="FilterType1" VerticalAlignment="Stretch" Grid.IsSharedSizeScope="False" ClipToBounds="False">
    
    <igRibbon:CheckBoxTool Id="CheckBoxSMD" Caption="SMD" Grid.Column="0" Grid.Row="0" Name="CheckBoxSMD" Checked="ComponentsFilterCheckBoxChanged" Unchecked="ComponentsFilterCheckBoxChanged" />
    
    <igRibbon:CheckBoxTool Id="CheckBoxTH" Caption="TH" Grid.Column="1" Grid.Row="0" Name="CheckBoxTH" Checked="ComponentsFilterCheckBoxChanged" Unchecked="ComponentsFilterCheckBoxChanged" />
    
    <igRibbon:CheckBoxTool Id="CheckBoxMEC" Caption="MEC" Grid.Column="2" Grid.Row="0" Name="CheckBoxMEC" Checked="ComponentsFilterCheckBoxChanged" Unchecked="ComponentsFilterCheckBoxChanged" />
    
    </igRibbon:ButtonGroup>
    
    <igRibbon:ButtonGroup Name="FilterType2" VerticalAlignment="Stretch" Grid.IsSharedSizeScope="False" ClipToBounds="False">
    
    <igRibbon:CheckBoxTool Id="CheckBoxPCB" Caption="PCB" Grid.Column="0" Grid.Row="1" Name="CheckBoxPCB" Checked="ComponentsFilterCheckBoxChanged" Unchecked="ComponentsFilterCheckBoxChanged" />
    
    <igRibbon:CheckBoxTool Id="CheckBoxCAD" Caption="CAD" Grid.Column="1" Grid.Row="1" Name="CheckBoxCAD" Checked="ComponentsFilterCheckBoxChanged" Unchecked="ComponentsFilterCheckBoxChanged" />
    
    <igRibbon:CheckBoxTool Id="CheckBoxVAR" Caption="VAR" Grid.Column="2" Grid.Row="1" Name="CheckBoxVAR" Checked="ComponentsFilterCheckBoxChanged" Unchecked="ComponentsFilterCheckBoxChanged" />
    
    </igRibbon:ButtonGroup>
    
    </igRibbon:RibbonGroup>
    
    <igRibbon:RibbonGroup Caption="Stock Movement Filter" Name="RibbonGroupStockMovementFilter" > 
    
    <igRibbon:CheckBoxTool Id="CheckBoxOrders" Caption="Orders" Name="CheckBoxOrders" Checked="StockMovementFiltersCheckBoxChanged" Unchecked="StockMovementFiltersCheckBoxChanged" />
    
    <igRibbon:CheckBoxTool Id="CheckBoxProduction" Caption="Production" Name="CheckBoxProduction" Checked="StockMovementFiltersCheckBoxChanged" Unchecked="StockMovementFiltersCheckBoxChanged" />
    
    <igRibbon:CheckBoxTool Id="CheckBoxAdjustments" Caption="Adjustments" Name="CheckBoxAdjustments" Checked="StockMovementFiltersCheckBoxChanged" Unchecked="StockMovementFiltersCheckBoxChanged" /> 
    
    </igRibbon:RibbonGroup>
    
    <igRibbon:RibbonGroup Caption="Productions" Name="RibbonGroupProduction" >
    
    <igRibbon:ToolVerticalWrapPanel>
    
    <igRibbon:CheckBoxTool Id="CheckBoxOpenProductions" Caption="Open Productions" Name="CheckBoxOpenProductions" Checked="ProductionFiltersCheckBoxChanged" Unchecked="ProductionFiltersCheckBoxChanged" IsChecked="True" />
    
    <igRibbon:CheckBoxTool Id="CheckBoxClosedProductions" Caption="Closed Productions" Name="CheckBoxClosedProductions" Checked="ProductionFiltersCheckBoxChanged" Unchecked="ProductionFiltersCheckBoxChanged" />
    
    <igRibbon:CheckBoxTool Id="CheckBoxFiller" Caption="Filler" Name="CheckBoxFiller" Visibility="Hidden" />
    
    </igRibbon:ToolVerticalWrapPanel>
    
    </igRibbon:RibbonGroup>
    
    <igRibbon:RibbonGroup Caption="Purchasing" Name="RibbonGroupPurchasing" >
    
    <igRibbon:ToolVerticalWrapPanel>
    
    <igRibbon:ButtonTool Caption="New Order Item" SmallImage="Images/NewOrderItem16x16.gif" Name="ButtonNewOrderItem" Click="ButtonNewOrderItem_Click" />
    
    <igRibbon:ButtonTool Caption="New Order" SmallImage="Images/NewOrder16x16.gif" Name="ButtonNewOrder" Click="ButtonNewOrder_Click" />
    
    <igRibbon:ButtonTool Caption="Button 3" SmallImage="Images/NewItem.gif" Name="ButtonPurchasing2" Visibility="Hidden" />
    
    </igRibbon:ToolVerticalWrapPanel>
    
    </igRibbon:RibbonGroup>
    
    
    <igRibbon:RibbonGroup Caption="Layout" Name="RibbonGroupLayout" >
    
    <Grid >
    
    <Grid.RowDefinitions>
    
    <RowDefinition />
    
    <RowDefinition />
    
    <RowDefinition />
    
    </Grid.RowDefinitions>
    
    <Grid.ColumnDefinitions>
    
    <ColumnDefinition />
    
    <ColumnDefinition />
    
    </Grid.ColumnDefinitions>
    
    <igRibbon:ComboEditorTool Caption="Layouts:" Name="ComboLayouts" SelectedItemChanged="ComboLayouts_SelectedItemChanged" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" ></igRibbon:ComboEditorTool>
    
    <igRibbon:ButtonTool Name="ButtonSaveLayout" Caption="Save Layout" SmallImage="Images/Save16ng.GIF" Click="ButtonSaveLayout_Click" Grid.RowSpan="1" Grid.Row="2" />
    
    <igRibbon:ButtonTool Name="ButtonDelLayout" Caption="Delete Layout" SmallImage="Images/DeleteLayout16n.gif" Grid.Column="1" Grid.Row="2" Click="ButtonDelLayout_Click" />
    
    <igRibbon:ButtonTool Name="ButtonColumns" Caption="Columns" SmallImage="Images/Columns16ng.gif" Click="ButtonColumns_Click" Grid.Row="1" />
    
    </Grid>
    
    </igRibbon:RibbonGroup>
    
    </igRibbon:RibbonTabItem>
    
    <igRibbon:RibbonTabItem Header="Comparisons - References" Name="RibbonTabItemToolbar2">
    
    <igRibbon:RibbonGroup Caption="Compare Versions" >
    
    <igRibbon:ToolHorizontalWrapPanel>
    
    <Grid>
    
    <Grid.RowDefinitions>
    
    <RowDefinition />
    
    <RowDefinition />
    
    </Grid.RowDefinitions>
    
    <Grid.ColumnDefinitions>
    
    <ColumnDefinition />
    
    <ColumnDefinition />
    
    <ColumnDefinition />
    
    </Grid.ColumnDefinitions>
    
    <igRibbon:ButtonTool Name="SetLeftPartListVersion" Grid.Row="0" Caption="Set Left" VerticalAlignment="Center" SmallImage="Images/NextDoc16x16.gif" Margin="10,0,5,0" Click="SetLeftPartListVersion_Click"></igRibbon:ButtonTool>
    
    <igRibbon:ButtonTool Name="SetRightPartListVersion" Grid.Row="1" Caption="Set Right" VerticalAlignment="Center" SmallImage="Images/NextDoc16x16.gif" Margin="10,0,5,0" Click="SetRightPartListVersion_Click"></igRibbon:ButtonTool>
    
    <igRibbon:LabelTool Grid.Row="0" Grid.Column="1" Caption="Left: " HorizontalAlignment="Right" Margin="10,0,5,0" ></igRibbon:LabelTool>
    
    <igRibbon:LabelTool Grid.Row="1" Grid.Column="1" Caption="Right: " HorizontalAlignment="Right" Margin="10,0,5,0" ></igRibbon:LabelTool>
    
    <igRibbon:TextEditorTool Name="textEditorPartlistVersionLeft" EditAreaWidth="200" Height="20" Grid.Row="0" Grid.Column="2" VerticalAlignment="Center" IsReadOnly="True" ></igRibbon:TextEditorTool>
    
    <igRibbon:TextEditorTool Name="textEditorPartlistVersionRight" EditAreaWidth="200" Height="20" Grid.Row="1" Grid.Column="2" VerticalAlignment="Center" IsReadOnly="True" ></igRibbon:TextEditorTool>
    
    </Grid>
    
    
    
    <igRibbon:ButtonTool Name="ComparePartlists" Caption="Compare" VerticalAlignment="Center" SmallImage="Images/CompareDocuments16x16.gif" Margin="10,0,10,0" Click="ComparePartlists_Click"></igRibbon:ButtonTool>
    
    </igRibbon:ToolHorizontalWrapPanel>
    
    </igRibbon:RibbonGroup>
    
    <igRibbon:RibbonGroup Caption="References" Name="RibbonGroupReferences" >
    
    <igRibbon:ToolVerticalWrapPanel>
    
    <igRibbon:ButtonTool Caption="Used by" SmallImage="Images/LinkedTo.GIF" Name="ButtonUsedBy" Click="ButtonUsedBy_Click" />
    
    </igRibbon:ToolVerticalWrapPanel>
    
    </igRibbon:RibbonGroup>
    
    </igRibbon:RibbonTabItem>
    
    <igRibbon:RibbonTabItem Header="System Administration" Name="RibbonTabItemSystemAdministration">
    
    <igRibbon:RibbonGroup Caption="New Window" HorizontalAlignment="Left" Name="RibbonGroupSysAdminNewWindow" >
    
    <igRibbon:ButtonTool Caption="Users" SmallImage="Images/NewWindow3.gif" Name="ButtonNewUsersWindows" Visibility="Visible" Click="ButtonNewUsersWindows_Click" />
    
    <igRibbon:ButtonTool Caption="AAA" SmallImage="Images/NewWindow2.gif" Name="ButtonNewAAAWindows" Visibility="Hidden" />
    
    <igRibbon:ButtonTool Caption="BBB" SmallImage="Images/NewWindow1.gif" Name="ButtonNewBBBWindows" Visibility="Hidden" />
    
    </igRibbon:RibbonGroup>
    
    <igRibbon:RibbonGroup Caption="Edit" HorizontalAlignment="Left" Name="RibbonGroupEditSA" >
    
    <Grid>
    
    <Grid.ColumnDefinitions>
    
    <ColumnDefinition />
    
    <ColumnDefinition />
    
    </Grid.ColumnDefinitions>
    
    <Grid.RowDefinitions>
    
    <RowDefinition />
    
    <RowDefinition />
    
    <RowDefinition />
    
    </Grid.RowDefinitions>
    
    <igRibbon:ButtonTool Grid.Column="0" Grid.Row="0" Caption="New" SmallImage="Images/NewItem.gif" Name="ButtonNewItemSA" Click="ButtonNewItem_Click" />
    
    <igRibbon:ButtonTool Grid.Column="0" Grid.Row="1" Caption="Clone" SmallImage="Images/CloneItem.gif" Name="ButtonCloneItemSA" Click="ButtonCloneItem_Click" />
    
    <igRibbon:ButtonTool Grid.Column="1" Grid.Row="0" Caption="Edit" SmallImage="Images/Edit16NG.gif" Name="ButtonEditItemSA" Click="ButtonEditItem_Click" />
    
    <igRibbon:ButtonTool Grid.Column="1" Grid.Row="1" Caption="Del" SmallImage="Images/DeleteItem.gif" Name="ButtonCutItemSA" Click="ButtonCutItem_Click" Visibility="Visible" />
    
    <igRibbon:ButtonTool Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" Caption="Not yet used" SmallImage="Images/NewItem.gif" Name="ButtonNotYetUsed" Visibility="Hidden" />
    
    </Grid>
    
    </igRibbon:RibbonGroup>
    
    </igRibbon:RibbonTabItem>
    
    
    <igRibbon:XamRibbon.ApplicationMenu>
    
    <igRibbon:ApplicationMenu Image="/WeyPartsUserInterface;component/Images/WeyLogo32x32.gif" />
    
    </igRibbon:XamRibbon.ApplicationMenu>
    
    <igRibbon:XamRibbon.QuickAccessToolbar>
    
    <igRibbon:QuickAccessToolbar />
    
    </igRibbon:XamRibbon.QuickAccessToolbar>
    
    </igRibbon:XamRibbon>
    
    <igDock:XamDockManager Grid.Row="1" HorizontalAlignment="Stretch" Name="xamDockManagerMain" VerticalAlignment="Stretch" 
    
    Theme="Office2k7Blue" PaneNavigatorButtonDisplayMode="Always" ActivePaneChanged="xamDockManagerMain_ActivePaneChanged">
    
    <igDock:DocumentContentHost ActiveDocumentChanged="DocumentContentHost_ActiveDocumentChanged" Name="DocContentHostMain">
    
    <igDock:SplitPane >
    
    <igDock:TabGroupPane Name="tabGroupPaneMainContent" SelectionChanged="tabGroupPane1_SelectionChanged">
    
    
    </igDock:TabGroupPane>
    
    </igDock:SplitPane>
    
    </igDock:DocumentContentHost>
    
    </igDock:XamDockManager> 
    
    <TextBlock Text="Footer Area here" Grid.Row="2"/>
    
    </Grid>
    
    </Window>
    

     

     


    UserControl BaseContentControl

    <UserControl x:Class="WeyPartsUserInterface.BaseContentControl"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:igRibbon="http://infragistics.com/Ribbon" xmlns:igDock="http://infragistics.com/DockManager" 
        xmlns:igDP="http://infragistics.com/DataPresenter" xmlns:igEditors="http://infragistics.com/Editors"
        xmlns:local="clr-namespace:WeyPartsUserInterface" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2006"  
        xmlns:igWindows="http://infragistics.com/Windows"
                 
        Height="504" Width="1017" Name="BaseContentCtrl" Loaded="BaseContentCtrl_Loaded" Initialized="BaseContentCtrl_Initialized">
        <UserControl.Resources>
            <Style x:Key="LayoutIdx1Style" TargetType="{x:Type igDP:DataRecordCellArea}">
                <!-- <Setter Property="Foreground" Value="Red"/> -->
                <Setter Property="Background" Value="Silver"/>
                <!-- <Setter Property="FontFamily" Value="Comic Sans MS"/> -->
            </Style>
            <local:TestConverter x:Key="testConverter" />
            <local:OrdersContentControlBkgConv x:Key="ordersContentControlBkgConv" />
            <local:StockMovementsContentControlBkgConv x:Key="stockMovementsContentControlBkgConv" />
            
        </UserControl.Resources>
        <Grid>
            <Grid.ContextMenu>
                <ContextMenu AllowDrop="False" />
            </Grid.ContextMenu>
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="60" />
            </Grid.RowDefinitions>
            <igDP:XamDataGrid HorizontalAlignment="Stretch" Name="xamMainDataGrid" VerticalAlignment="Stretch" Grid.Row="0" 
                                              BindToSampleData="False" Theme="Office2k7Blue" RecordActivated="xamMainDataGrid_RecordActivated" 
                                                RecordLoadMode="LoadOnDemand" RecordContainerGenerationMode="Recycle"
                                                UpdateMode="OnUpdate" FieldLayoutInitializing="xamMainDataGrid_FieldLayoutInitializing" RecordExpanded="xamMainDataGrid_RecordExpanded" MouseDoubleClick="xamMainDataGrid_MouseDoubleClick" PreviewKeyUp="xamMainDataGrid_PreviewKeyUp" AutoFit="False" FieldLayoutInitialized="xamMainDataGrid_FieldLayoutInitialized" ScrollingMode="Immediate" RecordsDeleted="xamMainDataGrid_RecordsDeleted" RecordsDeleting="xamMainDataGrid_RecordsDeleting_1" >
                <igDP:XamDataGrid.ContextMenu>
                    <ContextMenu />
                </igDP:XamDataGrid.ContextMenu>
    
                <igDP:XamDataGrid.FieldSettings>
                    <igDP:FieldSettings CellClickAction="SelectRecord" AllowEdit="False" AllowFixing="Near"/>
                </igDP:XamDataGrid.FieldSettings>
                
                <igDP:XamDataGrid.FieldLayoutSettings>
                    <igDP:FieldLayoutSettings HeaderPrefixAreaDisplayMode="FieldChooserButton" AddNewRecordLocation="OnTopFixed"></igDP:FieldLayoutSettings>
                </igDP:XamDataGrid.FieldLayoutSettings>
                <!-- BEGIN CODE for displaying the field sort order in the column labels. -->
                <igDP:XamDataGrid.Resources>
                    <local:ColumnSortOrderEvaluator x:Key="conv"/>
    
                    <Style TargetType="{x:Type igDP:DataRecordPresenter}" x:Key="OrdersBkgStyle" >
                        <Setter Property="Background" >
                            <Setter.Value>
                                <SolidColorBrush Color="{Binding Path=DataItem.Grade, Converter={StaticResource ordersContentControlBkgConv}}"  Opacity="0.5" />
                            </Setter.Value>
                        </Setter>
                    </Style>
    
                    <Style TargetType="{x:Type igDP:DataRecordPresenter}" x:Key="StockMovementsBkgStyle" >
                        <Setter Property="Background" >
                            <Setter.Value>
                                <SolidColorBrush Color="{Binding Path=DataItem.State, Converter={StaticResource stockMovementsContentControlBkgConv}}"  Opacity="0.5" />
                            </Setter.Value>
                        </Setter>
                    </Style>
    
                    
                    
                    
                    <Style TargetType="{x:Type igDP:LabelPresenter}">
                        <Setter Property="ContentTemplate">
                            <Setter.Value>
                                <DataTemplate DataType="{x:Type igDP:LabelPresenter}">
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock  Text="{TemplateBinding Content}"/>
                                        <TextBlock x:Name="status">
                                            <TextBlock.Text>
                                                <MultiBinding Converter="{StaticResource conv}">
                                                    <MultiBinding.Bindings>
                                                        <Binding Path="Field.Owner.SortedFields" RelativeSource="{RelativeSource FindAncestor,
                                                            AncestorType={x:Type igDP:LabelPresenter}}"/>
                                                        <Binding Path="Field" RelativeSource="{RelativeSource FindAncestor,
                                                            AncestorType={x:Type igDP:LabelPresenter}}"/>                                                                                                        
                                                        <Binding Path="Field.SortStatus" RelativeSource="{RelativeSource FindAncestor,
                                                            AncestorType={x:Type igDP:LabelPresenter}}"/>
                                                        
                                                    </MultiBinding.Bindings>
                                                </MultiBinding>
                                            </TextBlock.Text>
                                        </TextBlock>
                                    </StackPanel>
                                    <DataTemplate.Triggers>
                                        <DataTrigger Binding="{Binding Path=Field.SortStatus,
                                            RelativeSource={RelativeSource FindAncestor,
                                                            AncestorType={x:Type igDP:LabelPresenter}}}" Value="NotSorted">
                                            <Setter Property="Visibility" Value="Hidden" TargetName="status"/>
                                        </DataTrigger>
                                    </DataTemplate.Triggers>
                                </DataTemplate>
                            </Setter.Value>
                        </Setter>
                        <!-- new part -->
                        <Setter Property="Padding" Value="5,4,5,4"/>
                        <Setter Property="Background" Value="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, LabelBackground}}"/>
                        <Setter Property="LabelHighlight" Value="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, LabelHighlight}}"/>
                        <Setter Property="InnerBorderBrush" Value="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, LabelInnerBorder}}"/>
                        <Setter Property="OuterBorderBrush" Value="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, LabelOuterBorder}}"/>
                        <Setter Property="Foreground" Value="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, LabelForeground}}"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type igDP:LabelPresenter}">
                                    <ControlTemplate.Resources>
                                        <Storyboard x:Key="sbHighlightOn">
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="highlight">
                                                <SplineDoubleKeyFrame Value="0" KeyTime="00:00:00"/>
                                                <SplineDoubleKeyFrame Value="1" KeyTime="00:00:00.1750000"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                        <Storyboard x:Key="sbHighlightOff">
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="highlight">
                                                <SplineDoubleKeyFrame Value="0" KeyTime="00:00:00.25"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                        <Storyboard x:Key="SigmaFadeIn">
                                            <!-- 
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="SummaryButton" Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            -->
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="FixedButton" Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="1"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                        <Storyboard x:Key="SigmaFadeOut">
                                            <!-- 
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="SummaryButton" Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                                                <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0.4"/>
                                            </DoubleAnimationUsingKeyFrames>
                                            -->
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="FixedButton" Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                                                <SplineDoubleKeyFrame KeyTime="00:00:00.2000000" Value="0.7"/>
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </ControlTemplate.Resources>
                                    <Grid Margin="2,4,2,4" Background="#00000000">
                                        <!-- Background Bar -->
                                        <Border
    					                    Width="Auto"
    					                    Height="Auto"
    					                    RenderTransformOrigin="0.5,0.5"
    					                    CornerRadius="{DynamicResource {ComponentResourceKey {x:Type igDP:XamDataGrid}, LabelCornerRadius}}"
    					                    SnapsToDevicePixels="True"
    					                    Background="{TemplateBinding Background}"
    					                    x:Name="background"/>
                                        <!-- Highlight -->
                                        <Border
    						                x:Name="highlight"
    						                Opacity="0"
    						                Width="Auto"
    						                Height="Auto"
    						                CornerRadius="2,2,2,2"
    						                Background="{TemplateBinding LabelHighlight}"/>
                                                        <Rectangle
    						                Stroke="{TemplateBinding OuterBorderBrush}"
    						                StrokeThickness="1"
    						                RadiusX="1.55015910897703"
    						                RadiusY="1.55015910897703"
    						                Fill="Transparent"
    						                Margin="0,0,0,0"
    						                x:Name="lineOuter"
    						                Width="Auto"
    						                Height="Auto"/>
                                        <Rectangle
    						Stroke="{TemplateBinding InnerBorderBrush}"
    						StrokeThickness="1"
    						RadiusX="0.550159108977027"
    						RadiusY="0.550159108977027"
    						Fill="Transparent"
    						Margin="1,1,1,1"
    						x:Name="lineInner"
    						Width="Auto"
    						Height="Auto"/>
                                        <Grid
    						Margin="{TemplateBinding Padding}"
    						HorizontalAlignment="Stretch"
    						VerticalAlignment="Stretch"
    						x:Name="sortIndicatorAndLabel">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="Auto"/>
                                            </Grid.ColumnDefinitions>
                                            <Grid.RowDefinitions>
                                                <RowDefinition />
                                                <RowDefinition />
                                            </Grid.RowDefinitions>
                                            <ContentPresenter
    							                x:Name="LabelContent"
    							                Focusable="False"
    							                Content="{Binding Path=Content, RelativeSource={RelativeSource TemplatedParent}}"
    							                ContentTemplate="{TemplateBinding ContentTemplate}"
    							                ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
    							                d:LayoutOverrides="Width, Height"
    							                VerticalAlignment="Center"
                                                Grid.ColumnSpan="4"
                                                />
                                            <igWindows:SortIndicator
    							x:Name="SortIndicator"
    							SortStatus="{TemplateBinding SortStatus}"
    							Visibility="Collapsed"
    							HorizontalAlignment="Left"
    							VerticalAlignment="Center"
    							Width="Auto"
    							Grid.Column="1"
                                Grid.Row="1"                       
    							Margin="2,0,0,0"/>
                                            <igDP:FixedFieldButton
    							x:Name="FixedButton"
    							Field="{TemplateBinding Field}"
    							Visibility="{TemplateBinding FixedButtonVisibility}"
    							HorizontalAlignment="Left"
    							VerticalAlignment="Center"
    							Width="Auto"
    							Grid.Column="0" Grid.Row="1"
    							Margin="0,0,2,0"
    							Opacity="0.7"/>
                                            <Button VerticalContentAlignment="Top" 
                                        HorizontalContentAlignment="Right"
                                        Visibility="Collapsed"></Button>
                                            <!-- SSP 3/31/08 - Summaries Functionality -->
                                            <!-- 
                                            <igDP:SummaryButton
    							x:Name="SummaryButton"
    							Field="{TemplateBinding Field}"
    							Visibility="{Binding Path=Field.AllowSummariesResolved, RelativeSource={RelativeSource TemplatedParent}}"
    							HorizontalAlignment="Right"
    							VerticalAlignment="Center"
    							Width="Auto"
    							Grid.Column="2" Grid.Row="1"
    							Margin="5,0,0,0"
    							Opacity="0.4"/>
                                            -->
                                            <!-- JJD 1/06/09 - Filtering Functionality -->
                                            <!--
                                            <igDP:FilterButton
    							x:Name="FilterButton"
    							Field="{TemplateBinding Field}"
    							Visibility="{TemplateBinding FilterButtonVisibility}"
    							HorizontalAlignment="Left"
    							VerticalAlignment="Center"
    							Width="Auto"
    							Grid.Column="3" Grid.Row="1"
    							Margin="5,0,0,0"/>
                                            -->
                                            <!-- JM 1/14/09 - Fixed Fields Functionality -->
    
                                        </Grid>
                                    </Grid>
                                    <ControlTemplate.Triggers>
                                        <!--<DataTrigger Binding="{Binding Path=Field.LabelTextAlignmentResolved, RelativeSource={RelativeSource Self}}" Value="Center">
                            <Setter Property="HorizontalAlignment" TargetName="sortIndicatorAndLabel" Value="Center"/>
                        </DataTrigger>-->
                                        <Trigger Property="IsDragSource" Value="True">
                                            <Setter TargetName="highlight" Property="Opacity" Value="1"/>
                                        </Trigger>
                                        <!-- HighlightPrimary -->
                                        <Trigger Property="HighlightAsPrimary" Value="true">
                                            <Setter TargetName="highlight" Property="Opacity" Value="1"/>
                                        </Trigger>
                                        <Trigger Property="HorizontalAlignment" Value="Center">
                                            <Setter Property="VerticalAlignment" TargetName="SortIndicator" Value="Top"/>
                                            <Setter Property="HorizontalAlignment" TargetName="SortIndicator" Value="Center"/>
                                            <Setter Property="Margin" TargetName="SortIndicator" Value="0,5,0,0"/>
                                        </Trigger>
                                        <!-- Only animate highlight -->
                                        <MultiTrigger>
                                            <MultiTrigger.Conditions>
                                                <!--<Condition Property="SortStatus" Value="NotSorted"/>-->
                                                <Condition Property="IsMouseOver" Value="True"/>
                                            </MultiTrigger.Conditions>
                                            <MultiTrigger.EnterActions>
                                                <BeginStoryboard Storyboard="{StaticResource sbHighlightOn}" x:Name="sbHighlightOn_BeginStoryboard"/>
                                                <BeginStoryboard Storyboard="{StaticResource SigmaFadeOut}" x:Name="SigmaFadeIn_BeginStoryboard"/>
                                                <BeginStoryboard x:Name="SigmaFadeIn_BeginStoryboard1" Storyboard="{StaticResource SigmaFadeIn}"/>
                                            </MultiTrigger.EnterActions>
                                            <MultiTrigger.ExitActions>
                                                <BeginStoryboard Storyboard="{StaticResource sbHighlightOff}" x:Name="sbHighlightOff_BeginStoryboard"/>
                                                <BeginStoryboard Storyboard="{StaticResource SigmaFadeOut}" x:Name="SigmaFadeOut_BeginStoryboard"/>
                                                <StopStoryboard BeginStoryboardName="SigmaFadeIn_BeginStoryboard1"/>
                                            </MultiTrigger.ExitActions>
                                        </MultiTrigger>
                                        <Trigger Property="SortStatus" Value="Ascending">
                                            <Setter TargetName="highlight" Property="Opacity" Value="1"/>
                                            <Setter TargetName="SortIndicator" Property="Visibility" Value="Visible"/>
                                        </Trigger>
                                        <Trigger Property="SortStatus" Value="Descending">
                                            <Setter TargetName="highlight" Property="Opacity" Value="1"/>
                                            <Setter TargetName="SortIndicator" Property="Visibility" Value="Visible"/>
                                        </Trigger>
                                    </ControlTemplate.Triggers>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                        <!-- end of new part -->
                    </Style>
                </igDP:XamDataGrid.Resources>
                <!-- END CODE for displaying the field sort order in the column labels. -->
    
            </igDP:XamDataGrid>
            <Grid AllowDrop="True" Name="DetailsGrid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Grid.Row="1">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="1*" />
                    <ColumnDefinition Width="2*" />
                    <ColumnDefinition Width="1*" />
                    <ColumnDefinition Width="2*" />
                    <ColumnDefinition Width="1*" />
                    <ColumnDefinition Width="2*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                    <RowDefinition></RowDefinition>
                </Grid.RowDefinitions>
                <igRibbon:LabelTool Name="LabelDetail1" Caption="LabelDetail1" HorizontalAlignment="Right" Grid.Row="0" Grid.Column="0" Height="20" VerticalAlignment="Center" />
                <igEditors:XamTextEditor Name="TextEditorDetail1" Grid.Row="0" Grid.Column="1" Theme="Office2k7Blue" IsReadOnly="True">
                </igEditors:XamTextEditor>
                <igRibbon:LabelTool Name="LabelDetail2" Caption="LabelDetail2" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="0" Height="20" VerticalAlignment="Center" />
                <igEditors:XamTextEditor Name="TextEditorDetail2" Grid.Row="1" Grid.Column="1" Theme="Office2k7Blue" IsReadOnly="True">
                </igEditors:XamTextEditor>
                <igRibbon:LabelTool Name="LabelDetail3" Caption="LabelDetail3" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="0" Height="20" VerticalAlignment="Center"/>
                <igEditors:XamTextEditor Name="TextEditorDetail3" Grid.Row="2" Grid.Column="1" Theme="Office2k7Blue" IsReadOnly="True">
                </igEditors:XamTextEditor>
                <igRibbon:LabelTool Name="LabelDetail4" Caption="LabelDetail4" HorizontalAlignment="Right" Grid.Row="0" Grid.Column="2" Height="20" VerticalAlignment="Center" />
                <igEditors:XamTextEditor Name="TextEditorDetail4" Grid.Row="0" Grid.Column="3" Theme="Office2k7Blue" IsReadOnly="True">
                </igEditors:XamTextEditor>
                <igRibbon:LabelTool Name="LabelDetail5" Caption="LabelDetail5" HorizontalAlignment="Right" Grid.Row="1" Grid.Column="2" Height="20" VerticalAlignment="Center"/>
                <igEditors:XamTextEditor Name="TextEditorDetail5" Grid.Row="1" Grid.Column="3" Theme="Office2k7Blue" IsReadOnly="True">
                </igEditors:XamTextEditor>
                <igRibbon:LabelTool Name="LabelDetail6" Caption="LabelDetail6" HorizontalAlignment="Right" Grid.Row="2" Grid.Column="2" Height="20" VerticalAlignment="Center"/>
                <igEditors:XamTextEditor Name="TextEditorDetail6" Grid.Row="2" Grid.Column="3" Theme="Office2k7Blue" IsReadOnly="True">
                </igEditors:XamTextEditor>
                <igRibbon:LabelTool Caption="LabelDetail7" HorizontalAlignment="Right" Name="LabelDetail7" Grid.Row="0" Grid.Column="4" Height="20" VerticalAlignment="Center"/>            
                <igDP:XamDataGrid Grid.Column="5" Grid.Row="0" Grid.RowSpan="3" Margin="2" Name="xamDataGridDetailsList" Theme="Office2k7Blue" IsNestedDataDisplayEnabled="False" AutoFit="True" GroupByAreaLocation="None" ScrollingMode="Immediate" VerticalContentAlignment="Center" MouseDoubleClick="xamDataGridDetailsList_MouseDoubleClick">
                    
                    <igDP:XamDataGrid.FieldLayoutSettings>
                        <igDP:FieldLayoutSettings LabelLocation="Hidden" AllowAddNew="False" AllowDelete="False"  SummaryDescriptionVisibility="Hidden" AutoFitMode="Always" ></igDP:FieldLayoutSettings>
                    </igDP:XamDataGrid.FieldLayoutSettings>
                    <igDP:XamDataGrid.FieldSettings>
                        <igDP:FieldSettings CellClickAction="SelectRecord" AllowEdit="False" ScrollViewer.HorizontalScrollBarVisibility="Hidden"    />
                    </igDP:XamDataGrid.FieldSettings>
                </igDP:XamDataGrid>
            </Grid>
        </Grid>
    </UserControl>
    


     

     

     

    Thursday, March 18, 2010 7:59 AM
  • Hi Ken

    Thanks for your answer. Unfortunately it's not as simply as you think. The text box is not part of the grid, but part of a ribbon bar at the top of my window.  The gris is part of a UserControl that has nothing to do with the text box. Text box and grid are even in seperate XAML files.
    For that reason I'm rather comfused by the behaviour I see.

    Markus
    Thursday, March 18, 2010 10:08 AM
  • What happens if you force the keyboard focus on the text box using Keyboard.Focus() ? If it works (sets the keyboard focus on textbox) you could call Keyboard.Focus on MouseDown and GotFocus (tabbing) event handlers for the textbox.

    Also check the Focusable property on elements using Snoop. Focusable property should be true for an element to get keyboard focus.

    You could also hookup event handlers for GotFocus/LostFocus and GotKeyboardFocus/LostKeyboardFocus events on multiple elements and try to understand the flow of logical and keyboard focus.

    Thursday, March 18, 2010 6:40 PM
  • Hi Shreedhar

    Thank you for your good suggestions. I will try them post the results.

    Markus

    Friday, March 19, 2010 9:40 PM
  • Hi Markus,

    Any updates?

    Thanks,
    Jie
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    If you have any feedback, please tell us.

    The All-In-One Code Framework Project
    My Blog (in Simplified Chinese)
    Thursday, March 25, 2010 7:50 AM
    Moderator
  • Hi,

    you could also try using a CommandBinding to perform the search, instead of an event handler. You could define a RoutedCommand as follows:

    <Window.Resources>
         <RoutedCommand x:Key=SearchCommand/>
    </Window.Resources>

    Then you would define an InputBinding and a CommandBinding directly on the TextBox:

    <TextBox.InputBindings>
         <KeyBinding Gesture="Enter" Command="{StaticResource SearchCommand}"/>
    </TextBox.InputBindings>
    <TextBox.CommandBindings>
        <CommandBinding Command="{StaticResource SearchCommand}" Executed="MySearchHandler"/>
    </TextBox.CommandBindings>
    Since this command and inputbinding would be defined only on the TextBox, it will only affect this, and you will not have to juggle around with keyboard focus.
    http://wpfglue.wordpress.com
    Thursday, March 25, 2010 9:20 AM
  • Hi Shreedhar

    It took a bit longer as expected to try out our suggestions. I had to do some work on another project. I meanwhile did some tests with Keyboard.Focus(.). I see that my text box gets the Keyboard focus, but it's then assigned back to my grid.

    I think the problem is related to the Infragistics control (and their implementation) and is not a general WPF problem.

    Markus

     

    Saturday, March 27, 2010 9:40 AM
  • Hi hbark

    Thanks for your suggestion. I tried this out, but had no luck. The command does not get triggered! I think that something wrong with the implementation of the controls I use (by Infragistics). I think I it's an issue the Infragistics support has to work on.

    Markus

     

    Saturday, March 27, 2010 9:43 AM