Search code examples
c#wpfbindinguielement

Is it right or wrong to have a UIElement as a property of a code behind object?


I have an object called Block, and an object called Cell. Basically, block has a collection of cells. As far as UI, a block is a Grid. The Grid's children are cells that are TextBoxes. Now, my question is whether or not it's good or bad practice, or if there are any pros or cons to instancing a TextBox within the Cell object, and instancing a Grid within the Block object. Also, since there's a property for the instance of those UIElements, is there a way to bind to that property?


Solution

  • Scott Hanselman discusses with Ian Griffiths the issues of what to include and what to not include in a WPF view in detail in this podcast. Well worth the 30 minutes:

    http://hanselminutes.com/default.aspx?showID=184