Size GridViewItems to fill GridView?

大憨熊 提交于 2019-12-06 03:36:12

My teammate Dwayne had the solution, but it took us a while to figure it out.

  • Create DependencyProperties for the GridViewItem's desired width and height.
  • Measure the size of the GridView on its SizeChanged event. (Our problem was trying to get a value that wasn't zero--other events wouldn't render the panel at the right time.)
  • Bind the ItemContainer WrapGrid's ItemWidth and ItemHeight to these DependencyProperties. Setting the width and height in the DataTemplate won't work.

One of those problems with a bunch of separate little pieces needing stitching together.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!