In WPF, has anybody animated a Grid?

前端 未结 7 1884
走了就别回头了
走了就别回头了 2020-12-11 00:32

I have 2 columns in a Grid. When I click a button, I want the first column to animate to the left from it\'s current position to 0. So, in effect, it collapses and I\'m le

相关标签:
7条回答
  • 2020-12-11 01:20

    I have taken Todd Miranda's C# source code and modified it, to demonstrate how to animate DataGrid Column widths shrinking & expanding.

    Here's the source code...

    http://www.pocketpctoolkit.com/WPF/DataGridColumnWidthAnimation.zip

    Basically, you click on a CheckBox, and whichever DataGrid columns have their "MinWidth" value set to 0 will be shrunk to zero-width. Click the CheckBox again, the columns will animate back to their original widths.

    This WPF code also demonstrates how to create animations / storyboards in code behind.

    0 讨论(0)
提交回复
热议问题