c# - Popup dimensions on screen -
i thought understood wpf content scaling system ran issue that's mysterious me. have simple popup supposed used loupe opens on top of image when user clicks image. xaml this:
<popup name="loupepopup" allowstransparency="true" isopen="false" staysopen="true"> <border borderthickness="2" borderbrush="azure" /> </popup>
in code behind, tie popup's placement image showing when popup opened. set loupe size half size of image code:
loupepopup.placementtarget = fullimg; loupepopup.placement = placementmode.relative; loupepopup.width = fullimg.actualwidth / 2; loupepopup.height = fullimg.actualheight / 2;
further code moves loupe along mousemove, not relate issue here: i'd expect loupe half width/height of image, not - quite bit larger (by 18%). verified actual image size , actual size of window on displayed, mouse coordinates. dimensions/point coordinates made perfect sense, why popup not use same width/height scaling other elements here?
for clarification: image covers 80% or of screen, not issue of few pixels. window child window created in code, , popup defined in xaml of main window, both windows set full screen size.
appreciate thoughts!
maybe because border thickness not taking account when calculating loupepopup size or default margin , padding of popup or image
Comments
Post a Comment