Setting the width of a Silverlight combo box to fit its widest item

In a Silverlight application, I have several combo fields with data content. How do I set the width of the combo box so it can fit its widest item?

I created a hack that works in WPF, but it doesn't work in Silverlight - which is unfortunately expected; ^ (

I could create a workaround by measuring the width of the text, but that would be a very hard coded implementation, so I would like to find another way.

I can't believe this is an unsupported scenario, but I couldn't find a solution. Hope I missed something ...

+2


source to share


1 answer


Would it be hardcoded if you bind to a database and then cycle through the elements measuring the width of the text? Seems pretty dynamic (if clumsy)



0


source







All Articles