I have a custom control that I’ve placed inside a cell of a grid. I have some internal calculations I need to run based on the height and width of the custom control. However, I want it to resize based on the size of the cell.
So, my main question is… how to I programatically determine the height and width of a given cell?
It may be easier to figure out the Height and Width of your Custom Control rather than the cell of a DataGrid.
Your control should have access (through FrameWork Element) to the properties ActualHeight and ActualWidth. These properties will update when the size changes.
Also, the SizedChanged event will be fired on your control every time the Height and Width change.
I highly recommend placing this height and width logic inside of your control. You do not want to be limited to only placing your custom control inside of DataGrids.