Auto adjust windows application screen size according to screen resolution - wpf

I'm currently making an application which contains 1 window and many similar formatted page (width = 800, height = 450).
If I don't define the minwidth and minheight then the screen looks like this(below image) and If I define minwidth and minheight(1000,650) then the screen is not fitting to all screen resolutions(In small resolution laptops the screen is cutting).
How can I make the window fit to screen resolution with minimum of width and height as(70%,70%)of screen resolution.
I've tried using this.sizetocontent=SizeToContent.WidthAndHeight but no use.Can anyone please help me with this.
Thank you :)

Setting Screen size
Width =System.Windows.SystemParameters.PrimaryScreenWidth;
Height = System.Windows.SystemParameters.PrimaryScreenHeight;
setting 70% as min size
MinWidth=70* width / 100 ;
MinHeight=70* height / 100 ;

Related

what is the best way to Calculate responsive height, width and font-size for both operating system [React Native]?

what is the best practice to calculate height, width and font-size for both operating system?
There is an easy way you can deal with it.
1 .
import {Dimensions} from 'react-native';
let heightOfScreen = Dimensions.get('window').height
let width = Dimensions.get('window').width
And now suppose in your phone you have the height 100 to be correct, and your phone height is 640 pixels , so do , *(100/640)100 = 15.6 so now you can set any view height to <View style={{height:15.6*heightOfScreen}} > and it willbe dynamic for all mobile devices, both cross platform, you dont have to worry about this looks small in some phone and all. Ive used this and its one of the best in built feature of react-native to provide screen dimensions.
Simliarly you can do for width too.
Hope it helps. feel free for doubts
You can import Dimensions from react-native and you can calculate the height and width of the device screen. And by calculating height & width you can use them accordingly as per your need.

How to maintain scroll position on window resize while using scrollmagic

I have a fixed container of 100vh x 100vw that contains 6 absolutely positioned divs that are 100vh x 100vw.
I use a dummy element that is positioned relative w/ 6 divs that are 100vh to trigger each scene.
When I resize the window, the scene's animation moves forward and backward in time. Is there a way to prevent that from happening?
The issue is that when you resize the window, the position of the scroll bar remains fixed at an absolute number of pixels. However, because your content is based on view height, the height of the document changes dynamically as you resize the window. Thus, the window scroll position as a percentage of the document body height is also changing, and this is what ScrollMagic bases progress on.
To illustrate with simplified math:
A) Given a window height of 1000px, your document height will be 6vh * 1000px = 6000px tall. If your window scroll position is 1200px, you'll be 20% of the way through the overall ScrollMagic timeline.
B) If you resize the browser to 800px tall, that changes the document height to 6hv * 800px = 4800px tall. However the window scroll position will remain at 1200px, which is now 25% of the way through the ScrollMagic timeline.
The simplest solution is probably to keep your document a fixed height.

set max width and height in percentages of screen size for lightbox image

I am using Lightbox v2.51 by Lokesh Dhakar. Is there a way to set max height and width value according to users screen resolution? I want to have the images fill most of the screen area.
Thanks.

WPF Resize Image - Fixed with, sliding height

I have an image in WPF which I would like to enlarge to a fixed width (say 800px).
The image should stretch to this width using the original aspect ratio (so not as to distort) and the height should be scaled as necessary.
If the height is not too large for the container the top of the image should show at the top of the container. The image should then slide upwards until the bottom of the image reaches the bottom of the container via an animation (so at some point the whole image has been displayed).
Links or suggestions highly appreciated

Recommended Height and Width for WPF window design

What is the recommended height and width for a WPF application?
Should I start with screen resolution 1024 x 768 or 800 x 600?
What is the recommended, DockPanel or StackPanel? Which is able to scale to the maximum of a screen size?
What is the recommended Height and Width for WPF application?
I think there is no recommended Height and Width because it depends on user to user or System Screen Resolution. You can't predict what Screen Resolution user screen will be in advance it should be generic. And also it depends upon how you managed controls within that window ? Are they Expandable or Fixed Height and Width .
What is the recommended, DockPanel or StackPanel, which is able to scale to the maximum of a screen size?
Different Panel Controls have there different importance but i think Grid is the best Panel Control at Window Level.
I hope this will help.

Resources