NavigationView Compact and Overlay - c#

I`m exploring the navigationview control for uwp projects. I noticed that when I resize the window to a smaller size the menu changes to compact mode and, if the the window is small enough it overlays over the right page window rather than pushing it to the side.
I want to change the navigationview control to have this behavior by default without having to resize the window to a smaller size. The goal is to have the page window with the most space available possible.
I tried some properties but none worked, any pointers how to change this default behavior(Overlay and always in compact mode)?

you should use the latest NavigationView by winui library, and in this control you have a property PaneDisplayMode, explore values of this property and you can know what exactly you want. In your scenario you want the left pane to completely disappear and overlay then you can try LeftMinimal but if you want it in compact mode which shows only Icons then you can use LeftCompact

You can try to confugure the CompactModeThresholdWidth and ExpandedModeThresholdWidth properties of NavigationView. These properties will get or set the minimum window width at which the NavigationView enters Compact or Expanded display mode.
<NavigationView CompactModeThresholdWidth="280" ExpandedModeThresholdWidth="2800"/>
You can set the width value base on your requirement. For example, if you want the NavigationView alway in Compact Mode, you can use above code with any CompactModeThresholdWidth property value smaller than the minimum default UWP app window width and the ExpandedModeThresholdWidth property value larger than the maximum window width.

Related

UWP XAML NavigationMenu Change behavior

I'm using NavigationView in a UWP project that contains a Frame to load pages.
When the windows is small enough the NavigationView Pane is automatically closed only showing the Icons of the MenuItems, if the Menu is specifically opened (clicking the top button) the menu overlaps the pages inside the frame (this happens after a given threshold, when the Window becomes smaller)
I was trying to maintain this behavior all the time (instead of only when the window is resized to small values), even if the window is maximized or is resized to large values.
isPaneOpen appears to be a read only property that does not work at Run time.
The overlap (rather than pushing the frame to the right) I don't know how to get this NavigationView display all the time...
Any help how to do this?
Thank you.
As your description, it seems you want to maintain the NavigationView always in the Compact mode, you can implement this effect by overriding the widths at which the navigation view changes display modes using the CompactModeThresholdWidth and ExpandedModeThresholdWidth properties.
You can try to configure your NavigationView as the following code,
<NavigationView CompactModeThresholdWidth="280" ExpandedModeThresholdWidth="2000"/>
You can set any CompactModeThresholdWidth property value smaller than the minimum default UWP app window width and the ExpandedModeThresholdWidth property value larger than the maximum window width.
More details, please see the NavigationView display modes topic.

How to use Visual Studio's C# Windows Forms Design View for a Scalable/Resizable Window?

I am attempting to create a Windows Forms Application that will have components that scale when the window is being resized. I am running into issues with the Form when attempting to resize it when the application is running. First of all, this is what it looks like in the editor at its Minimum Size:
Then I stretch it out at run time and it is even on both sides (after tinkering with the Fixed-Splitter position:
I run into more problems when attempting to put List Boxes in the blue and red panels. In design:
Stretched:
I want the list boxes to nicely fill most of the width of each side, but when I attempt to use the Anchor tags it gets messed up.
So to sum up: Why is the designer all asymmetrical compared to the finished product and how do I make the List Boxes fit and scale in width when the window is resized?
I am using VS17 if that helps! Thanks!
The anchors was always (I don't know why) littlebit broken. Use the composition of nested Panels and use the Dock and Padding properties instead of anchros.

Aero borders cut off space from my WPF window

Unfortunately I can't provide screenshots for comparison now, since I'm unable to use Aero here at work, but I'm having the following problem:
I'm creating a small WPF application. My main window is not resizable, and the sizes and positions of everything inside are fixed. Everything works fine here using some pre-defined theme (it's "Windows Classic" most likely). Once I run the exe at home though - with Aero enabled - the border size is way bigger, but the actual total window size stays the same it seems to me. So the borders go "into" my window, shrinking the actual usable space and thus some of my controls are overlapped by the borders and it looks asymmetrical.
What can I do about this, if anything? Is there some option to make the borders be attached "outside" my used window space?
Edit: Here is an uploaded image of the Aero version. I hope the problem can be seen. (It's at the bottom)
In my opinion a static size is a bad way in wpf.
There are different solutions:
1. make your window a bit heigher or
2. reduce the margin between your used content elements or
2. use a dynamic size of your content. A grid with rowdefinitions set to "X*" where x is the height in propotion to total height of your content.
But im not sure ... you use a style in your app or is the style directly set into element? If you use a xaml stysle file, is it possible the style overrides your set position or margin properties?

borderless wpf window behavior for .net 3.5

Does anyone know how to have a borderless wpf window in .Net 3.5?
Basically I am trying to have the same window as in mahapps metro but in .net 3.5. When I try to use the borderless behavior in the mentioned library, I get a thick dark border around right/bottom side of the window.
I want to avoid AllowsTransparency and use hook messages instead
Try setting the ResizeMove to NoResize or CanMinimize. This will remove the border.
NoResize or CanMinimize gets rid of the nice drop shadow effect and I don't want to loose the resizing (with grip).
In that case you should implement your own shadow (not so hard - just put everything inside one Border with desirable margin and set the DropShadowEffect). CanMinimize will still allow you to resize the window, but you must still implement your own resizing.
If you want to get rid of the border altogether, you have to set "WindowStyle" to "None" and the "ResizeMode" to "NoResize" or "CanMinimize".

How to center vertically items on Toolstrip (Flow mode)?

In my Winforms application I have a toolbar that contains many items (buttons with icon 32px, labels and comboboxes).
I decided to set the Toolstrip.LayoutStyle property from the default HorizontalStackWithOverflow to Flow in order to allow the toolbar split automatically on more rows when user have a very low resolution monitor or he/she resize the window.
The problem is that all labels and comboboxes are aligned to the top of Toolstrip when I change the LayoutStyle.
Does exist a property or any other workaround that allow me to center them vertically?
I think I see what you mean, the label isn't as tall as, say, a button. And it gets aligned improperly with LayoutStyle = Flow. Ugh. You can work around it by changing the Padding property of the label. To do this properly, you should however do this in the form's OnLoad() method override, the label will be taller when you run on a machine with a higher video DPI setting.

Categories

Resources