Hello,
The code snippet on this page is useful. However, when trying to using it, it can't find some members.
LogicalOperator, ComboItemFilter.Condition. In what assembly are these included ?
Thank
http://help.infragistics.com/doc/WPF/2016.1/CLR4.0/?page=xamComboEditor_Custom_Filtering.html
I found the issue. I was missing the DataManager assembly.
Question:
How can I get selected item to look exactly like the populated item ?
Thank you
Hello User101,
I am glad you were able to find the assembly that contains the filter-related items for the XamComboEditor.
Regarding getting the selected item to look exactly like the populated item, I am assuming this means that you have an ItemTemplate in your XamComboEditor and you are looking to have the selected item respect that ItemTemplate. Please let me know if this assumption is incorrect, as the following is based on it.
If your ItemTemplate is just text, I would recommend creating a separate property in your ViewModel that allows you to set the DisplayMemberPath to it. This will allow the selected item to look like the displayed item without any template-modification.
If it has other elements, such as images, I would recommend that you navigate to the generic.xaml file commonly found at C:\Program Files (x86)\Infragistics\<your version here>\WPF\DefaultStyles\XamComboEditor and pull in the default style for XamComboEditor. Inside this template, there exists a SpecializedTextBox element that I would recommend that you replace with a ContentPresenter. You can bind this ContentPresenter's Content property to the SelectedItem property of the XamComboEditor and bind the ContentTemplate property to the ItemTemplate property of your XamComboEditor.
I have attached a sample project to demonstrate the above. I hope this helps.
One limitation of this is that this solution may prevent your user from actually entering "edit mode" as the editable SpecializedTextBox in this case will have been replaced. The drop-down can still be opened, and the editor edited that way, but the auto-complete and "edit mode" will be gone with this route.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer
Thank you Andrew. Works Perfectly.
I apologize for the delay in my response. I have taken a look at the sample project, and I see the behavior that you are referring to.
In this case, the text isn't really "justified" in either way. When you click on an item in the XamComboEditor in the attached sample project, the display text is longer than the combo editor itself, and the cursor defaults to the end of the text, rather than the beginning. Naturally, this leads to you seeing the end of the text.
If you would like to prevent this, I would recommend hooking into the SelectionChanged event of the XamComboEditor. In this event handler, you can use the Infragistics.Windows.Utilities class and its static GetDescendantFromType method to get the underlying SpecializedTextBox that the editor uses to display its selected item. You can then set the SelectionStart property of this textbox to "0," as this will move the cursor to the start of the display text. I would also recommend placing a little delay on this, by placing this code in a Dispatcher.BeginInvoke action running at Background priority. The full code for this would look like the following:
Dispatcher.BeginInvoke(new Action(() =>{ SpecializedTextBox text = Utilities.GetDescendantFromType(DemoXamComboEditor, typeof(SpecializedTextBox), false) as SpecializedTextBox; text.SelectionStart = 0; }), DispatcherPriority.Background);
I have also attached a modified version of the sample project you sent to demonstrate. I hope this helps you.
Hello Andrew,
Have you had a chance to look at the sample project ?
Thanks
Sorry about the confusion. I should have provided more details.
I have attached a sample project to demo the issue. When an item is selected, it displays the last part of the text. When it looses focus it displays the first part of the text.
I am rather confused by your most recent post. I would expect that if the XamComboEditor has its text left-justified, that it would remain as such when focused and when not. One thing that you can do to ensure this is to use the following style. Note, that this will only work if the modifications that you have made still include the SpecializedTextBox in the template of the XamComboEditor:
<ig:XamComboEditor.Resources> <Style TargetType="{x:Type igPrim:SpecializedTextBox}"> <Setter Property="HorizontalContentAlignment" Value="Right"/> </Style></ig:XamComboEditor.Resources>