Windows Phone - Loading/Saving panel - controls

I often need loading panel, which shows an indeterminate progressbar and a textblock in fullscreen mode. I do this with a Grid and just set the visibilty so visible. Instead of copy source code from page to page, I want to re-use it as a control. Is there already an existing control I can use?

Create your own usercontrol is the best way if you want to reuse the control. There are a lot of guides on Google, search for "custom user control silverlight" or something similar.

Related

WinRT Settings Charm. Elements overlayed by on screen keyboard

I'm developing for Windows 8 (WInRT) and have problem with settings charm. Settings popup is based on Microsoft SDK settings charm. Settings panel is Popup. Content is wrapped by ScrollViewer -> Grid -> StackPanel. In StackPanel I have input fields. when I trying to fill last of them on screen keyboard overlaying it and I cant see field and cant scroll to it. Is there any way to see it and to scroll to it automatically?
Seems like the popups on Windows 8 suffer from the same problem as they did on Windows Phone in that when you put a TextBox on one of them - it does not get pushed up together with all the other content as it does when it is not in a popup.
My solution to that would be to not use popup for input fields and instead go for a layout that you can manage yourself.
By default the app has a Frame control at its visual root. You can modify it for example by putting your own UserControl in there (I usually call it AppShell) which has the Frame used by all pages, you can have a layer for popups, log in screens, the extended splash screen etc.
To solve your problem you would need to put your charm's UI inside of such layer instead of in a popup. Then the build-in mechanism that pushes all the UI up when the on-screen keyboard would otherwise obstruct the view of your TextBox should just start working again.
*EDIT
A simpler solution might be to make sure your settings panel popup is parented in your visual tree - e.g. by adding it as a child element to a root grid of your app or page. It turns out that in that case its content does get pushed up when the OSK shows up.
Take a look at this post
It's a popup wrapper (turns user controls into popups) that takes care of the keyboard appearing and adjusts the size of the popup (and thus the user control) accordingly.

Buttons on ApplicationBar (WP7)

If you open settings of wifi and choose any network you will see Password textbox and BUTTONS (not icons) in ApplicationBar. How it is made? Is it some kind of ApplicationBar template? Or it is some Border control, but how to show a Border above the SIP(keyboard)?
Any ideas how to make the same thing?
What are you describing was not created using Silverlight (all the "hero" applications are done in C++) and are therefore not limited by the current SL feature set.
In relation to your actual question, it is not possible to template the ApplicationBar nor is it even possible to determine when the SIP is displayed (or what its height is).
In short, I'd stick to icons if you want your application to work well across devices.

How to add an application bar to a user control in wp7

I have built a wizard style user control that lets you add stackpanel based pages and flick between them.
I would like to add an application bar as part of the user control with next and previous buttons that enable/disable based on page displayed etc.
Application bar appears to be an attached property of PhoneApplicationPage. I have tried referencing Microsoft.Phone.Shell but get invalid type.
Any ideas how I can add it to my user control?
Application bar is such a pain in the a**. This control is not a Silverlight one but a native one. Maybe you can be more lucky with this solution:
http://blog.humann.info/post/2010/08/27/How-to-have-binding-on-the-ApplicationBar.aspx
The ApplicationBar is a service that is provided by the operating system, i.e. not part of the Framework, and can only be used at the page-level, not in your UserControl. In addition, the ApplicationBar does not support regular bindings as you've seen. As mentioned above there are a number of solutions that provide workarounds for this problem.
Alternatively, you could use the ApplicationBarButtonCommand and ApplicationBarButtonNavigation behaviors from the Silverlight Windows Phone Toolkit. It's a simple enough task to create your ApplicationBarMenuCommand if you need one.

MFC: Scrollable Panel/Sub-windows containing controls

Whats the best way to create a 'scrollable panel' in MFC (C++) ? In the past I have displayed different windows "attached" or "on top" of my main dialog window as a means of display different pages of an application. What I want to do this time is create a panel of controls that can be scrolled (because the virtual size of the panel is bigger than the size of the panel itself).
Can anybody recommend any good articles or tutorials on how best to do this?
Thanks
You can create an independent scrollbar control on the side of your dialog. Respond to the messages in the dialog to move your controls. Since the child windows will crop themselves to the parent client area, feel free to move them completely off the dialog as they scroll off the page.
If you place the controls in a CScrollView or a CFormView they will be automatically scrollable inside the view area.

Custom CommonDialog/PrintDialog Newbie Question

I am trying to create my first custom Print Dialog in C#. I found some samples online that I'm working with to do this.
What I want to do is to put a button underneath the Properties button in the upper right corner. The code samples I have seen so far put new controls on the bottom of the Dialog relative to the position of the OK and Cancel buttons. Those code samples allow one to retrieve the handle of the OK or Cancel buttons because they're universal constants in Dialog controls. Fair enough, but how would I go about getting the handle on the Properties button so I could insert my button underneath?
You can use SPY++ to figure out the control Id of any control, those ids a solid across Windows versions. You can read here (old but still relevant) on how to use SPY++ to obtain control Ids.

Resources