Reputation: 3900
Update
I've confirmed that this only seems to happen on a particular PC. I think it's somehow related to my hardware setup:
When I recently bought the adapter, I found something a little "off" with the video quality, as if it's scaling pixels despite Windows saying it's native resolution.
I've read a lot about USB-C video being a little unreliable. I wonder whether Windows or the Laptop might get confused about the resolution when waking up from sleep. This might conflict with the WPF display units.
Original Question
I must be missing something obvious, but how do I build a simple WPF window which actually fits within the Window Frame?
The problem:
I'm using Windows 10 and Visual Studio 2015, although the same thing happens with Kaxaml. This XAML:
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Grid>
</Grid>
</Window>
Results in the content, in this case a Grid, overhanging the window by a pixel or two:
Upvotes: 0
Views: 771
Reputation: 8363
How you managed to do this remains a mystery. I just can't reproduce this...
But I do have something you can try.
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
ClipToBounds="True">
<Grid>
</Grid>
</Window>
Actually I suddenly realized this only stops the extra pixels from visually appearing. This means that the Grid is still bigger than it should, and if there are contents that are rendered there, they are going to be clipped away. But if there are nothing rendered, this should at least make this window looks normal.
Anyway, this happening could be related to some weird windows theme that you applied or something? Some themes that made the window rendered smaller than what it should or something?
Upvotes: 2