WPF - wrapping stackpanel -


i have panel width = 1400 , contains smaller panels width = 700. if screen @ full width smaller panels should displayed in 2's per row otherwise should wrap , vertical scrollbar should appear.

with below code contents wrapped no scrollbar:

<stackpanel grid.column="1" grid.row="1" width="1400">     <scrollviewer x:name="body" horizontalscrollbarvisibility="disabled" verticalscrollbarvisibility="auto">         <wrappanel orientation="horizontal" maxheight="700" width="{binding elementname=body, path=viewportwidth}">             <border borderbrush="black" borderthickness="1" width="700" height="400">              </border>              <border borderbrush="black" borderthickness="1" width="700" height="400">              </border>              <border borderbrush="black" borderthickness="1" width="700" height="400">              </border>              <border borderbrush="black" borderthickness="1" width="700" height="400">              </border>         </wrappanel>     </scrollviewer> </stackpanel> 

what doing wrong?

edit

suggested solutions didn't work. current code:

<stackpanel grid.column="1" grid.row="1" background="#ffeaeefc">         <scrollviewer x:name="body" horizontalscrollbarvisibility="disabled">             <wrappanel margin="10" maxwidth="1400">                 <border borderbrush="black" borderthickness="1" width="700" height="400">                  </border>                  <border borderbrush="black" borderthickness="1" width="700" height="400">                  </border>                  <border borderbrush="black" borderthickness="1" width="700" height="400">                  </border>                  <border borderbrush="black" borderthickness="1" width="700" height="400">                  </border>             </wrappanel>         </scrollviewer>     </stackpanel> 

you have fixed width in main stackpanel prevent scrollviewer work. removing width="1400" should work.

edit: remove stackpanel or change dockpanel. content of stackpanel not resized according it.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -