Hey.
I have a combo box and when I leave the combo box with tab, enter or any other manor and lose focus I would like for the text to left align.
Well if I click on a dropdown item and then if I leave the combobox it will make the text left align on lost focus.
How could I make the text box in the combo editor always left align text?,
Thanks in advance :)
Hello,
Thank you for your post. I have been looking into it and I created a sample project for you following your scenario and everything seems to work ok on my side(the text is aligned on the left all the time). If the sample doesn’t satisfies all your needs feel free to modify it, so it reproduces your behavior and send it back to me for further investigation.
Looking forward for your reply.
Thanks for the fast reply. Your example works only if the text for the display item is shorter then the width combo box. If the length of the text is longer it does only show the end of the text and not the start of the text.
I have modified the sample, so now it has the functionality you want. Basically I handled the XamComboEditor's SelectionChanged, GotFocus and LostFocus events and in their handlers I set the SelectionsStart Property of the SpecializedTextBox inside the editor to 0. Please let me know if this helps you or you have further questions on this matter.
This worked great when I add a new item, but when the item that is binded when the combobox is created, is longer then the width of the combobox, this does not work. I tried to add your solution to the initialized event + Loaded event, but it did not work.
I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.
I was trying to use this, but it doesn't work if the user is keyboard centric. I can't tab out of the comboBox, nor can I figure out how to fix it.
Hey Laura.
If you could be more specific I can try out the issue you have, I did not have any issues after I implemented the fix. I am a bit curious, when do you create your view and viewModel. And do you use the constructor to populate the properties that are exposed to the view?
Øyvind
Hi Stefan.
I have added this request. So if we are lucky we get a fix where we dont need a dispatcher thread to set focus to the controler when we create a view.
http://ideas.infragistics.com/forums/192363-wpf/suggestions/6205536-xamcombobox-correctly-left-align-text
Cheers,
Hello Øyvind,
Currently this is the designed behavior of the XamComboEditor, so if you want it to be changed, you can suggest this as new product idea here:
http://ideas.infragistics.com/
We have had to implement several hacks to get the functionality wanted. This hacks are starting to be problematic when we move forward to add new functionality.
Will this problem be fixed anytime soon??