Results 1 to 4 of 4

Thread: wpf & Screen resolution

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2014
    Posts
    169

    wpf & Screen resolution

    friends
    Is there any code to setup WPF window to show(Display) with any screen resolution
    without Cut or become bigger than the screen

    Thanks

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,299

    Re: wpf & Screen resolution

    Please provide a FULL and CLEAR explanation of the problem. Obviously you can set the size of a window to whatever you want so are you actually asking how to determine what the current screen resolution is in order to know what to set that size to? If you maximise a window then it will occupy the whole screen regardless of resolution, so that's an answer to the question you actually asked but may not be what you really want to know.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2014
    Posts
    169

    Re: wpf & Screen resolution

    I want the app (window) to work with any screen resolution
    maybe like (responsive)

    i find this when searching

    Height="{Binding SystemParameters.PrimaryScreenHeight}"
    Width="{Binding SystemParameters.PrimaryScreenWidth}">

    should I use this method properties when begin design the window and controls

  4. #4

    Re: wpf & Screen resolution

    WPF works at any screen resolution, there's nothing special to do about it, other than keeping in mind that the 96dpi isn't carved in stone and that the margins and heights and other values are measured in device-independent pixels. Layout works very differently in WPF than it did in WinForms. Cropping and/or bleeding you seem to be experiencing sounds like you're possibly hard-coding control positions? In general you should avoid drag-and-drop in the xaml designer, since doing that places all controls in absolute positions (if you're coming from WinForms, this pretty much means un-learning everything you know about UI design)- instead you'll want to use panels and grids, and let the framework do the layout itself. A WrapPanel seems like a good start for a "responsive" design that re-positions itself depending on the available estate.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width