Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a WPF application and a dual monitor system. I have an application running on a screen with resolution 1920*1080. But when I drag and drop it to another screen of resolution 1366*768, the screen becomes scrollable. The content is not fitting the screen width. I need to scroll to see the other content.

Right now I am fetching the width of the active screen and calculating the width of all the controls. The screenWidth variable has the right value but it is not getting reflected.

Can this be fixed?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
155 views
Welcome To Ask or Share your Answers For Others

1 Answer

Try using Viewbox control, it will scale to fit the content to the available size. Hope you have not given fixed sized to grid. Use grid layout & width should always be kept to "auto".

<Viewbox>
        <StackPanel>
            <TextBlock FontSize="12">ABC</TextBlock>               
        </StackPanel>
</Viewbox>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...