InputAwarePanel Improvement + QKit Open Sourced


One of the limitations that my InputAwarePanel had was that even though it resized available space properly when the InputPane is shown, it didn’t actually keep the TextBox in view when that happened. Even though this sounds like a simple task, I quickly found out that it was quite the opposite. I’ll go over some of the issues I encountered, point out unresolved limitations, and show a small demo of it in action. Along with this little improvement, I’ve also made the source code available on CodePlex for anyone to check out and improve so please check it out and report any bugs you may find.

The Material

VS_IconCODEPLEX – view source + contribute
VS_IconNUGET – download and use

What Works

The InputPanelAware panel works the same as before. What’s different is now you don’t have to manually scroll TextBox in focus into view. Whenever a TextBox is focused and it’s in a ScrollViewer, the ScrollViewer will scroll it into view appropriately. This feature isn’t limited strictly to only TextBoxes. It also works with RichTextBox and PasswordBox but it doesn’t support scrolling to cursor position whereas the TextBox does. I’ve also intentionally omitted the AutoSuggestBox since it automatically handles scrolling into view out of the box.

Here’s a video of it in action:

InputAwarePanel Forms Sample Demo from QDev on Vimeo.

What Doesn’t Work

Like I mentioned before, only the TextBox control supports scrolling to cursor. This is helpful when the text input control is taller than the viewable area of the ScrollViewer. If the text input control is in view but extends below that viewable area, there’s a possibly that the cursor is still out view. The cursor is what the user is focused on and should be what’s brought into view. We can get the visual position of the cursor using TextBox’s GetRectFromCharacterIndex method and accomplish this. Unfortunately, the other text input controls do not so I can scroll into view the entire control and depend on the user to scroll to whatever they want to see.

In this current release, there’s no support for horizontal scrolling into view yet. I wanted to get this out since someone on MSDN forums was looking for a solution at he time of writing this.

Open Source

I’ve made the source code for this available on CodePlex for anyone to check out. The link can be found above. I’ll be trying to document this as much as possible there so anyone can easily use this. If you notice any bugs or issues, I’d be grateful if you bring it up there so I can improve this as much as I can. Of course, suggestions for improvements and contribution for fixes are always welcomed.


2 thoughts on “InputAwarePanel Improvement + QKit Open Sourced

  1. Thanks for open sourcing Qkit, I’ll take a look at porting my customizations for jumplists using observablecollections, as I was mentioning on the other post.

    However, I’m disappointed that you’ve selected codeplex, as it’s difficult to work with both as a website and in terms of using svn. Would you reconsider that decision, and take a look at github? Not only is there a lot more traffic there for open source projects but it’s far, far easier to manage contributions and forks.

    1. I’m fairly new to this kind of stuff so I just kind of picked one and went with it. I will look into it though. Thanks for the suggestion.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s