locked
Reserve space for at runtime generated image RRS feed

  • Question

  • Say my app has a grid with 2 columns each 50% of the screen area. In the left part I want to display an renderer image and on the right side properties (other xaml elements) are placed. At runtime a SurfaceImageSource (containing a D3D11 rendered texture) is bound to the Image.Source property.

    To create my rendered texture, I need to know how much space I have on screen. But there is my problem. Without hardcoding the Width and Height properties of the image element to some random value, the size is 0x0 at runtime (as there isn't an image yet). So, I have no idea how big I can make the SurfaceImageSource.

    Anyone who has an idea how to solve this problem? Any help is really appreciated.

    Jeroen


    • Edited by jbroekhu Wednesday, November 21, 2012 1:25 PM
    Wednesday, November 21, 2012 1:25 PM

Answers

  • We know there are 3 screen size that we have to need attention: 100%, 140% 180 % ( Guidelines for scaling to screens)

    Because you said the image will have 50% of space for image, then for 100%, 140% and 180% you know the specific size. For example, for 100% we have: 1366x768, with this i conclude your image will have 683X768.

    Another thing,  there is an event: SizeChanged (from the page) that you can subscrive and inside you can know the size for the page: width and height. One more times, is simple your image will have Page.ActualWidth/2 and Page.ActualHeight.

    Sara Silva
    My blog | My Windows 8 Store Apps Samples
    Follow me in Twitter @saramgsilva

    My Windows 8 Store Apps: Female Pill | Galinho (Tic tac Toe) | 24
    My Windows Phone Apps

    (If my reply answers your question, please propose it as an answer because it will help other users)



    • Edited by saramgsilva Wednesday, November 21, 2012 5:42 PM
    • Marked as answer by jbroekhu Wednesday, November 21, 2012 6:06 PM
    Wednesday, November 21, 2012 5:41 PM

All replies

  • We know there are 3 screen size that we have to need attention: 100%, 140% 180 % ( Guidelines for scaling to screens)

    Because you said the image will have 50% of space for image, then for 100%, 140% and 180% you know the specific size. For example, for 100% we have: 1366x768, with this i conclude your image will have 683X768.

    Another thing,  there is an event: SizeChanged (from the page) that you can subscrive and inside you can know the size for the page: width and height. One more times, is simple your image will have Page.ActualWidth/2 and Page.ActualHeight.

    Sara Silva
    My blog | My Windows 8 Store Apps Samples
    Follow me in Twitter @saramgsilva

    My Windows 8 Store Apps: Female Pill | Galinho (Tic tac Toe) | 24
    My Windows Phone Apps

    (If my reply answers your question, please propose it as an answer because it will help other users)



    • Edited by saramgsilva Wednesday, November 21, 2012 5:42 PM
    • Marked as answer by jbroekhu Wednesday, November 21, 2012 6:06 PM
    Wednesday, November 21, 2012 5:41 PM
  • That sounds like a good idea, thanks! I thought that somehow the layout manager would be responsible for it. But this way it shouldn't be too hard either.
    Wednesday, November 21, 2012 6:06 PM