AppBarButton in compact mode inside CommandBar - c#

I found in the documentation for CommandBar this description:
The app bar button controls are characterized by an icon and associated label. They have two sizes; normal and compact. By default, the text label is shown. When the IsCompact property is set to true, the text label is hidden. When used in a CommandBar control, the CommandBar sets the IsCompact property automatically as the control is opened and closed.
Am I able to somehow keep IsCompact mode active for AppBarButton also if a CommandBar is opened?
It works if I use AppBar, however, it does not have SecondaryCommands and also I can see in the documentation some kind of recommendation to use CommandBar instead of AppBar for Windows 10 apps.
You should use the AppBar only when you are upgrading a Universal Windows 8 app that uses the AppBar, and need to minimize changes. For new apps in Windows 10, we recommend using the CommandBar control instead.
I was experimenting with Opening and Opened events of CommandBar but I was not too much successful with any solution.

Override the AppBarButton template (fou can find it here: https://msdn.microsoft.com/en-us/library/windows/apps/mt299122.aspx?f=255&MSPPError=-2147217396), and remove the changes in the compact visualstate.
This way they'll always look the same.

Related

how to stop SizableToolWindow going under windows 10 taskbar when maximised?

I am developing a windows form application where one of the forms uses the border style of SizableToolWindow however this causes issues when you have the windows taskbar set to the side of the screen.
Is there any possible way to stop this happening without moving the taskbar?
Solved
Changed the window border to "sizeable"
Changed the window border to "sizeable"
suggested
Any reasons why you are using a ToolWindow when what you actually want to display is not a ToolWindow ? This works perfectly with a standard window – Franck

Open Windows 10 touch keyboard docked in WPF

We started creating a WPF touch application in Windows 8 and recently migrated to Windows 10. One feature we implemented is opening the Windows Keyboard when a TextBox receives focus. In Windows 8, it was possible to dock the keyboard to the bottom by setting the registry setting EdgeTargetDockedState and starting the TabTip process:
string path = #"C:\Program Files\Common Files\Microsoft Shared\ink\TabTip.exe";
var info = new ProcessStartInfo(path);
info.WindowStyle = ProcessWindowStyle.Maximized;
var p = new Process();
p.StartInfo = info;
p.Start();
The Windows 10 keyboard however doesn't seem to have the same dock behavior as in Windows 8. The keyboard now overlays any maximized window which hides the bottom part of any application. Only not-maximized windows are resized to fit the remaining space.
I've checked the following links, but found no solution:
https://superuser.com/questions/951841/windows-10-touch-keyboard-doesnt-dock-or-maximize-at-the-bottom-of-the-screen
http://answers.microsoft.com/en-us/windows/forum/windows_10-desktop/windows-10-touch-keyboard-doesnt-dock/3c253400-568f-4e89-a253-0d7a747b5b63
Can the Windows 10 keyboard be docked programmatically for a maximized window?
I open-sourced my project to automate everything concerning TabTip integration in WPF app.
You can get it on nuget, and after that all you need is a simple config in your apps startup logic:
TabTipAutomation.BindTo<TextBox>();
You can bind TabTip automation logic to any UIElement. Virtual Keyboard will open when any such element will get focus, and it will close when element will lose focus. Not only that, but TabTipAutomation will move UIElement (or Window) into view, so that TabTip will not block focused element.
For more info refer to the project site.
To clarify: If you will be using this package TabTip will not be docked, but your UI will be in view, which i guess is what you wanted to achieve.
Check this article:
http://www.codeproject.com/Tips/1120263/Virtual-Keyboard-TabTip-integration-in-WPF-on-Win
Virtual Keyboard will open when any such element will get focus, and it will close when element will lose focus.
EDIT: In the case when WindowStyle is set to None, please check out my answer here. Also for manually handling touch keyboard appearance events, check out the sample code here.
The answers here are quite old, currently the touch keyboard works just fine when tapping any textbox, even if the window is maximized.
I recommend targeting at least .NET 4.6.2 to get the best support for touch keyboards in Windows 10, due to a bug in WPF that was fixed in that version. Read more here, scroll down to WPF section.
The only thing you'll have to do is design your XAML in a way that your user interface can react properly when the touch keyboard shows up. Usually putting your content inside a ScrollViewer like so should be enough:
<ScrollViewer PanningMode="VerticalOnly"
VerticalScrollBarVisibility="Hidden"
HorizontalScrollBarVisibility="Disabled"
<!--Content here-->
</ScrollViewer>
But for more advanced scenarios, like moving buttons that are at the bottom to above the keyboard, you'll need to write your XAML inside the ScrollViewer more carefully, for example by using grids with dynamic heights.
Hope this helps!

Windows Phone Textbox - Keyboard does not show

I have a very simple scenario where I can focus an editable text box, the cursor appears inside the field, bt the keyboard will not show.
I have replicated this in a small sample app (Windows Phone 8.1 - Universal App). Very easy to recreate.
Create an 8.1 universal app. In the MainPage for phone add a text box and a button. The code for the button just sets the textbox to NOT read only. The default state of the textbox is ReadOnly.
Run app, select edit and then select the field. Cursor is present and keyboard opens. Close app.
Failure scenario:
Open app, touch read only text field. Note: No cursor is in box as it is read only.
Select Edit button. Tap the text field. Cursor is focused into field, but keyboard does not appear. I have a sample app with this behavior.
Any Resolutions?
This is a known issue in Windows Phone 8.1 which is fixed in current builds of Windows 10 Mobile.
Unfortunately I don't see any good workarounds for this on Windows Phone 8.1 other than "don't do that". Instead of switching a TextBox into and out of IsReadOnly mode try swapping between two TextBoxes (or a TextBox and a TextBlock).

Show a menuflyout from a button on another flyout Win 8.1 XAML

I've got a scenario in my app where I show a popup from a appbar button in Windows 8.x (using XAML/C#).
Prior to Win 8.1, I used Callisto to show the popup. In Win 8.1, I'm trying to use the built-in Flyout and MenuFlyout controls.
Simple flyouts and menu flyouts work - but when I try to show a menu flyout off of a button that is itself in a popup/flyout - it dismisses the previous flyout/parent flyout - which is not the desired behaviour.
Here is some code to reproduce the issue:
https://github.com/krishna-nadiminti/FlyoutTest
Any ideas on how to fix this?
Ideally - I don't want to go back to using Callisto in the Win8.1 project - because I want to use the same code as part of my framework to show flyouts and secondary flyouts in universal apps.

VS Windows Form App, Controlling Hover State (not Blue)

some of my button states in my Windows Form Application are defaulting to a blue Hover state. I am pretty new to VS and I am mainly using the GUI to modify the design, but I don't see anywhere where I can control just the color of the hover state of the buttons.
Can anybody tell me where I control this, whether it be programatically or in the GUI?
The windows operating system handles that.
To modify it, you would have to change the FlatStyle appearance to Flat and then modify the FlatAppearance attributes, which includes the MouseOverBackColor property.
Unfortunately, you lose the visual styles then.

Categories