Answered by:
Issue with Pen input in DirectX and Xaml interop scenario

Question
-
Hi,
I have a simple SwapChainBackgroundPanel setup with few xaml elements inside it.
<SwapChainBackgroundPanel x:Name="DxPanel"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="100" /> <ColumnDefinition /> </Grid.ColumnDefinitions> <Grid Background="#444"> <StackPanel Margin="0,50"> <Button Content="X123" /> <ListBox Margin="0, 30"> <ListBoxItem Content="111" /> <ListBoxItem Content="222" /> <ListBoxItem Content="333" /> </ListBox> </StackPanel> </Grid> </Grid> </SwapChainBackgroundPanel>
I handle the pointer events on the SwapChainBackgroundPanel (SCBP) and use them to do changes on the DirectX surface. Everything works fine with mouse and touch, however there is an issue with the Pen input:
If I press/move the pen over the SCBP, release (but keep the pen in range) and move over the xaml part - then any pen interaction (pointer over, press, etc.) is not detected by the xaml components.
You can check this isolated scenario ( http://sdrv.ms/H3vRLp ) with the following steps:
1. Unzip and run InputIssue.sln, Set InputIssue as StartUp Project
2. Compile and run on device with Pen input (Surface Pro)
3. Press and Move the pen over the empty area on the right
4. Release but keep the pen in range (you have to see the little black&white dot indicator)
5. While the pen is in range move it over the left part where the xaml controls are. Try to press the button or to select an item from the ListBox
In my tests (on Surface Pro with Windows 8.1 RTM) the xaml controls do not respond to any input in step 5). Only if the pen is moved out of range (~1.5 inch) and back in, then the controls start to respond.
Can you reproduce this issue? If you can, is this a known issue and is there a workaround?
Thanks
- Edited by Nik.Z Friday, October 18, 2013 6:39 AM
Thursday, October 17, 2013 4:27 PM
Answers
-
This is occurring because you do not relinquish the pointer to allow it to interact with the other UI elements. You will want to Release the pointer when the stylus is not in contact with the surface:
private void DxPanelOnPointerReleased(object sender, PointerRoutedEventArgs e) { DxPanel.ReleasePointerCapture(e.Pointer); this._pressed = false; }
Jeff Sanders (MSFT)
@jsandersrocks - Windows Store Developer Solutions @WSDevSol
Getting Started With Windows Azure Mobile Services development? Click here
Getting Started With Windows Phone or Store app development? Click here
My Team Blog: Windows Store & Phone Developer Solutions
My Blog: Http Client Protocol Issues (and other fun stuff I support)- Proposed as answer by Jeff SandersMicrosoft employee, Moderator Friday, October 18, 2013 1:54 PM
- Marked as answer by Nik.Z Saturday, October 19, 2013 1:12 PM
Friday, October 18, 2013 1:54 PMModerator
All replies
-
I will give this a try now Nik!
Jeff Sanders (MSFT)
@jsandersrocks - Windows Store Developer Solutions @WSDevSol
Getting Started With Windows Azure Mobile Services development? Click here
Getting Started With Windows Phone or Store app development? Click here
My Team Blog: Windows Store & Phone Developer Solutions
My Blog: Http Client Protocol Issues (and other fun stuff I support)Friday, October 18, 2013 12:15 PMModerator -
I can repro this on my Samsung Series 7. I think it has to do with the capture of the DX surface. I will dig a little more into the repro.
Jeff Sanders (MSFT)
@jsandersrocks - Windows Store Developer Solutions @WSDevSol
Getting Started With Windows Azure Mobile Services development? Click here
Getting Started With Windows Phone or Store app development? Click here
My Team Blog: Windows Store & Phone Developer Solutions
My Blog: Http Client Protocol Issues (and other fun stuff I support)Friday, October 18, 2013 12:44 PMModerator -
This is occurring because you do not relinquish the pointer to allow it to interact with the other UI elements. You will want to Release the pointer when the stylus is not in contact with the surface:
private void DxPanelOnPointerReleased(object sender, PointerRoutedEventArgs e) { DxPanel.ReleasePointerCapture(e.Pointer); this._pressed = false; }
Jeff Sanders (MSFT)
@jsandersrocks - Windows Store Developer Solutions @WSDevSol
Getting Started With Windows Azure Mobile Services development? Click here
Getting Started With Windows Phone or Store app development? Click here
My Team Blog: Windows Store & Phone Developer Solutions
My Blog: Http Client Protocol Issues (and other fun stuff I support)- Proposed as answer by Jeff SandersMicrosoft employee, Moderator Friday, October 18, 2013 1:54 PM
- Marked as answer by Nik.Z Saturday, October 19, 2013 1:12 PM
Friday, October 18, 2013 1:54 PMModerator -
Thanks.
While looking at the code again it's so obvious that this is the problem, however I was used to automatically loosing the capture when the pointer is released (in case of mouse or touch), but it looks like the case with the pen is a bit different.
Thank you for taking the time to look into this.
Saturday, October 19, 2013 1:18 PM