Hi,
i wrote my own XamGrid column with a XamComboEditor in it. I would like to set the width of the column to the maximum width of the XamComboEditor elements. How can i achieve this goal? The width of ComboEditorItem.Control is always 0.
Thanks
Thanks.
Setting Width to Star helped also.
Now i have another problem. I have some rows, which have child rows. These child rows contain a cell with a xamcomboeditor in it. Everytime i collapse a child row the xamcomboeditor selection changes to null. How can i avoid this?
So, the XamComboEditor virtualizes its contents, so first, most elements within it won't have a width. Also, controls will only be assigned to items once the dropdown is assigned, and they won't have sizes during that time. Also, you wouldn't check the width property of the control, you'd check the actualWidth.
The main problem is, that you can't be sure that you're calculating the actual width of the max item. Perhaps you could walk through the itemsSource, and find the length of the item.
You might be able to dot hat with a TextBlock and as you're looping through your data, set the Text property of the TExtBlock, and check its ActualWidthTextBlock tb = new TextBlock() { Text = "abc" };
width = Math.Max(width, tb.ActualWidth);
-SteveZ
Help?