Hi,
in my application WPF, I'm using combobox and I bind the ItemsSource with a collection read from database, I would:
- capitalize the item, how is the better way?
- how to set the width of combobox as the length of the items?
Thanks.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Feb 18, 2015, 9:58 AM
It also states in the MSDN documentation (see Remarks section) that this is how to specify auto-sizing behavior:
https://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.width(v=vs.110).aspx
Roberto SalemiPosted Feb 18, 2015, 4:46 AM
VulpesPosted Feb 17, 2015, 2:14 PM
In XAML it would be:
Width = "Auto"
Just try it.
Roberto SalemiPosted Feb 17, 2015, 12:28 PM
Roberto SalemiPosted Feb 17, 2015, 12:28 PM
VulpesPosted Feb 17, 2015, 11:24 AM
Roberto SalemiPosted Feb 17, 2015, 10:44 AM
Piyush PansuriyaPosted Feb 17, 2015, 5:29 AM
Create new collection and add item using foreach. at the adding time use item.ToUpper()
for capitalize.
You can not set the width of combobox as the length of items, because item's length may very every time.