<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://interactiveasp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Search results matching tags 'XAML', 'WPF', and '.NET'</title><link>http://interactiveasp.net/search/SearchResults.aspx?o=DateDescending&amp;tag=XAML,WPF,.NET&amp;orTags=0</link><description>Search results matching tags 'XAML', 'WPF', and '.NET'</description><dc:language>en-US</dc:language><generator>CommunityServer 2008 (Build: 30417.1769)</generator><item><title>Ink in WPF -- Using TextInputPanel for Text Input</title><link>http://interactiveasp.net/blogs/natesstuff/archive/2008/10/01/ink-in-wpf-using-textinputpanel-for-text-input.aspx</link><pubDate>Wed, 01 Oct 2008 18:08:18 GMT</pubDate><guid isPermaLink="false">b80005ef-4071-4968-b08e-765d7d71b33e:95</guid><dc:creator>NathanZaugg</dc:creator><description>&lt;p&gt;&lt;a href="http://interactiveasp.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/natesstuff/Ink_2D00_Logo_5F00_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 10px 5px 0px; border-right-width: 0px" height="79" alt="Ink-Logo" src="http://interactiveasp.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/natesstuff/Ink_2D00_Logo_5F00_thumb.png" width="148" align="left" border="0"&gt;&lt;/a&gt; WPF has built-in controls for ink, but is missing much of the API that is available in the TabletPC SDK 1.7.&amp;nbsp; As a result, unless you are doing the most basic and mundane ink you will be required to use this library.&amp;nbsp; One of those basic things that are missing is the ability to open the TextInputPanel in an WPF application.&amp;nbsp; &lt;/p&gt; &lt;p&gt;The TextInputPanel is a tool that ships with certain versions of Vista (in previous versions of windows it was called a Pen Input Panel) that enables handwriting recognition and an on-screen keyboard.&amp;nbsp; It makes text input into a text box easy when the user is operating with a Tablet PC.&amp;nbsp; The problem is that the .NET assembly only supports hwnd-based controls and WPF controls (thankfully) are not hwnd-based.&amp;nbsp; &lt;/p&gt; &lt;p&gt;So while trying to figure this out, and off the clock from the project I was on, I made a class that helped bridge the gap between WPF and the TextInputPanel.&lt;/p&gt; &lt;p&gt;&lt;a href="http://interactiveasp.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/natesstuff/TextInputPanel_5F00_2.png"&gt;&lt;img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="92" alt="TextInputPanel" src="http://interactiveasp.net/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/natesstuff/TextInputPanel_5F00_thumb.png" width="354" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;Before you try to use this you will need to do two things. &lt;/p&gt; &lt;p&gt;First you need to download and install the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=B46D4B83-A821-40BC-AA85-C9EE3D6E9699&amp;amp;displaylang=en" target="_blank"&gt;TabletPC SDK 1.7&lt;/a&gt; (if you haven't already) and download my class (&lt;a href="http://interactiveasp.net/media/p/94.aspx" target="_blank"&gt;Source&lt;/a&gt; / &lt;a href="http://interactiveasp.net/media/p/93.aspx" target="_blank"&gt;Binary&lt;/a&gt;)&lt;/p&gt; &lt;p&gt;Second you need to start the Tablet PC Input Panel if you on a regular PC.&amp;nbsp; To do this go to:&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;em&gt;Start -&amp;gt; All Programs -&amp;gt; Accessories -&amp;gt; Tablet PC -&amp;gt; Tablet PC Input Panel&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;To use the class as a binary application, simply add the DLL as a reference.&amp;nbsp; Once that is done you will need to create an instance of the class for each text box you wish to have ink input (shown below).&amp;nbsp; &lt;strong&gt;&lt;em&gt;IMPORTANT: THIS SHOULD BE DONE ON THE WINDOW LOAD EVENT! IF YOU PUT THIS CODE IN THE CONSTRUCTOR IT WILL NOT WORK!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt; &lt;blockquote&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Window &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
        &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;="http://schemas.microsoft.com/winfx/2006/xaml" 
        &lt;/span&gt;&lt;span style="color: red"&gt;x&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: red"&gt;Class&lt;/span&gt;&lt;span style="color: blue"&gt;="TestApp" 
        &lt;/span&gt;&lt;span style="color: red"&gt;Title&lt;/span&gt;&lt;span style="color: blue"&gt;="Ink Input App" 
        &lt;/span&gt;&lt;span style="color: red"&gt;Loaded&lt;/span&gt;&lt;span style="color: blue"&gt;="Window_Loaded"&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox &lt;/span&gt;&lt;span style="color: red"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;="tbTest" &lt;/span&gt;&lt;span style="color: red"&gt;Height&lt;/span&gt;&lt;span style="color: blue"&gt;="30" &lt;/span&gt;&lt;span style="color: red"&gt;Width&lt;/span&gt;&lt;span style="color: blue"&gt;="300" /&amp;gt; 
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Grid&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;protected &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InkInputPanel &lt;/span&gt;pnltbTestInk;&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;...&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;Window_Loaded(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RoutedEventArgs &lt;/span&gt;e)
{
    &lt;span style="color: green"&gt;// Enable the Ink Input Panel
    &lt;/span&gt;pnltbTestInk= &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InkInputPanel&lt;/span&gt;(tbTest, &lt;span style="color: blue"&gt;true&lt;/span&gt;);
}&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;The code above will display the TextInputPanel anytime the textbox has focus and will go away when it looses focus.&amp;nbsp; This is the simplest way to use the class.&amp;nbsp; If you are doing something more complex like making the input panel appear when a button is clicked you will have some slightly different code.&lt;/p&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;Window_Loaded(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RoutedEventArgs &lt;/span&gt;e)
{
&lt;/pre&gt;&lt;pre class="code"&gt;&lt;span style="color: green"&gt;    // Enable the Ink Input Panel
&lt;/span&gt;    pnltbTestInk = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InkInputPanel&lt;/span&gt;(tbTest, &lt;span style="color: blue"&gt;false&lt;/span&gt;); &lt;span style="color: green"&gt;// False for AutoShow&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;pre class="code"&gt;}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;InputFieldButton_Click(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RoutedEventArgs &lt;/span&gt;e) {
    tbTest.Focus();
    pnltbTestInk.Show();
}

&lt;span style="color: blue"&gt;protected void &lt;/span&gt;tbTest_LostFocus(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RoutedEventArgs &lt;/span&gt;e) {
    pnltbTestInk.Hide();
}&lt;/pre&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;&lt;em&gt;Just make sure that you focus the text box before you call show on the Text Input Panel.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Basically the class I created uses the COM object exposed by the SDK rather than the &lt;em&gt;Microsoft.Ink.dll&lt;/em&gt; assembly.&amp;nbsp; The COM object is called "&lt;em&gt;Microsoft PenInputPanel 1.7&lt;/em&gt;" and is found at &lt;em&gt;C:\Program Files\Common Files\Microsoft Shared\ink\tiptsf.dll&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;If you are able to make use of my class or have questions or feedback, please leave a comment!&lt;/p&gt;
&lt;h2&gt;UPDATE&lt;/h2&gt;
&lt;p&gt;I received a number of emails indicating that using this code for multiple text boxes didn't work (it threw a COM exception).&amp;nbsp; I have modified the code to fix this issue and have uploaded it.&amp;nbsp; Because of a COM limitation, there is a change in how you use the API.&amp;nbsp; The biggest change is that you only need one instance of the class and you can attach multiple text boxes to this one instance.&lt;/p&gt;
&lt;h4&gt;Example:&lt;/h4&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;protected &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InkInputPanel &lt;/span&gt;pnltbTest;&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;...&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;Window_Loaded(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RoutedEventArgs &lt;/span&gt;e) {
    pnltbTest = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InkInputPanel&lt;/span&gt;(tbTest, &lt;span style="color: blue"&gt;true&lt;/span&gt;);
    pnltbTest.AddAttachedTextBox(tbTest1, &lt;span style="color: blue"&gt;true&lt;/span&gt;);
    pnltbTest.AddAttachedTextBox(tbTest2, &lt;span style="color: blue"&gt;true&lt;/span&gt;);
    pnltbTest.AddAttachedTextBox(tbTest3, &lt;span style="color: blue"&gt;true&lt;/span&gt;);
}&lt;/pre&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;if you are going to hide and show the panel explictly, then you will need to use one of the indexers available on the InkInputPanel class.&lt;/p&gt;
&lt;h4&gt;Example:&lt;/h4&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;protected &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InkInputPanel &lt;/span&gt;pnltbTestInk;&lt;/pre&gt;
&lt;p&gt;...&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;Window_Loaded(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RoutedEventArgs &lt;/span&gt;e) {
    &lt;span style="color: green"&gt;// Enable the Ink Input Panel
    // Pass false for AutoShow
    &lt;/span&gt;pnltbTestInk = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InkInputPanel&lt;/span&gt;(tbTest, &lt;span style="color: blue"&gt;false&lt;/span&gt;); 
}

&lt;span style="color: blue"&gt;private void &lt;/span&gt;InputFieldButton_Click(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RoutedEventArgs &lt;/span&gt;e) {
    tbTest.Focus();
    pnltbTestInk[tbTest].Show();
}

&lt;span style="color: blue"&gt;protected void &lt;/span&gt;tbTest_LostFocus(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RoutedEventArgs &lt;/span&gt;e) {
    pnltbTestInk[tbTest].Hide();
}&lt;/pre&gt;&lt;/blockquote&gt;
&lt;h5&gt;Links&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a title="http://www.microsoft.com/downloads/details.aspx?FamilyId=B46D4B83-A821-40BC-AA85-C9EE3D6E9699&amp;amp;displaylang=en" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=B46D4B83-A821-40BC-AA85-C9EE3D6E9699&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=B46D4B83-A821-40BC-AA85-C9EE3D6E9699&amp;amp;displaylang=en&lt;/a&gt; 
&lt;li&gt;&lt;a title="http://interactiveasp.net/media/p/93.aspx" href="http://interactiveasp.net/media/p/93.aspx"&gt;http://interactiveasp.net/media/p/93.aspx&lt;/a&gt; 
&lt;li&gt;&lt;a title="http://interactiveasp.net/media/p/94.aspx" href="http://interactiveasp.net/media/p/94.aspx"&gt;http://interactiveasp.net/media/p/94.aspx&lt;/a&gt; 
&lt;li&gt;&lt;a title="http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=3943590&amp;amp;SiteID=1" href="http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=3943590&amp;amp;SiteID=1"&gt;http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=3943590&amp;amp;SiteID=1&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:B3E14793-948F-49af-A347-D19C374A7C4F:fd17a0fe-a10b-43dc-b57b-fa9db31dc34c" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;
&lt;script type="text/javascript"&gt;&lt;!--
digg_url = 'http://interactiveasp.net/blogs/natesstuff/archive/2008/10/01/ink-in-wpf-using-textinputpanel-for-text-input.aspx';
digg_title = 'Ink in WPF -- Using TextInputPanel for Text Input';
digg_bodytext = 'WPF has built-in controls for ink, but is missing much of the API that is available in the TabletPC SDK 1.7.&amp;nbsp; As a result, unless you are doing the most basic and mundane ink you will be required to use this library.&amp;nbsp; One of those basic things that are missing is the ability to open the TextInputPanel in an WPF application.&amp;nbsp;';
digg_topic = 'microsoft';
//--&gt;&lt;/script&gt;
&lt;script src="http://digg.com/tools/diggthis.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;/div&gt;</description></item></channel></rss>