Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF And VSTO 3.5 Keyboard Focus Question.

$
0
0
Hi All,

I am designing something like this :

A simple form(in wpf), which is set to topmost to true and the form is a non modal window. This form will be called by a VSTO addin in Excel. The XAML is like following :

<Window x:Class="Testing_WPF_Application.Trial"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Loaded="Window_Loaded"
    Title="Trial" Height="187" Width="300" Topmost="True"><Grid KeyDown="Grid_KeyDown"><TextBox Height="23" Margin="21,18,28,0" Name="textBox1" VerticalAlignment="Top" KeyDown="Grid_KeyDown" /><TextBox Height="23" Margin="21,50,28,0" Name="textBox2" VerticalAlignment="Top" /><TextBox Height="23" Margin="21,80,28,0" Name="textBox3" VerticalAlignment="Top" /><TextBox Margin="21,110,28,0" Name="textBox4" Height="23" VerticalAlignment="Top" /></Grid></Window>
Now whenever I open this form, since it is top most true, it appears above the Excel Window. however, I am unable to type anything in the textboxes. Whatever I try to type, the keyboard focus directly goes to the active cell in the excel application. Any idea how can I set focus to my textboxes, considering a fact that I need to show the form as non modal only.

Thanks,
Vikas
http://excelnoob.blogspot.com

Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>