Hi, I need to display one column in my xamdatagrid as combobox. So far what I did is: created a field with EdtorType of XamComboEditor
<
igDP:Field Name="SeconderyCode" Label="—…ƒ ™‰"> <igDP:Field.Settings > <igDP:FieldSettings AllowEdit="True" CellValuePresenterStyle="{StaticResource seconderyCodeBackgroundStyle}" EditorType="{x:Type dge:XamComboEditor}" > <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type dge:XamComboEditor}"> <Setter Property="DropDownButtonDisplayMode" Value="Always"/> <Setter Property="ItemsProvider" Value="{DynamicResourceComboEditorListSeconderyCode}"/> <Setter Property="FlowDirection" Value="LeftToRight"/> <Setter Property="HorizontalAlignment" Value="Left"/> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field> I attached the ItemsProvider as you can see to a dynamic resource which I supply in code:
ComboBoxItemsProvider ip = new ComboBoxItemsProvider(); DataTable dt = new DataTable(); dt.Columns.Add("ID", typeof(string)); dt.Columns.Add("Name", typeof(string)); dt.Rows.Add(new object[] { "", "".PadLeft(30) }); dt.Rows.Add(new object[] { "NOHON", "€ „… "}); dt.Rows.Add(new object[] { "ONLY", "ƒ"}); dt.Rows.Add(new object[] { "WITHOUT", "€"}); dt.Rows.Add(new object[] { "MINUS", "™‰‰ "}); dt.Rows.Add(new object[] { "EXT", "‰…‡ƒ"}); ip.ItemsSource = dt.DefaultView; ip.ValuePath = "ID"; ip.DisplayMemberPath = "Name"; this.Resources.Add("ComboEditorListSeconderyCode", ip);
Now, the issue is that I don't want to show all of the items in each record. I wnat to be able to choose which items would be displayed and which aren't in run time according to a condition in the EditModeStarting event. How can I accompish this? By the way, I'm not sure at all that the code I wrote up until now is the most appropriate for my purpose. If you have another way you belive it should be accomplished, please, tell me. Thank U!
hi, is there a solution to this, i also need it
Filtering the DataTable is not acceptable, because if I filter an item which is currently selected in another row in te field, it would change, it displays the value, instead of the display member path.
Can you supply me a sample of how can I attach a new data source to a specific cell in that field as it goes into edit mode, if it's possible...? It can't effect any other cell in that same field..
Thank U!
One way would be to filter the DataTable if this is acceptable in your scenario. If not, you would have to create a new data source and assign it to the ItemsProvider before opening the dropdown of the xamComboEditor.
By the way, I'm not sure that my implementation suites best for my needs as I described the in the last post. If you belive that another approach will be better, please tell me. Thank You!
what I'm seeing currently, is all of the items which are in the Name column. I want to be able to choose which items will be visible in which row. for example, in the first record I want only the first item to be visible, in the second, the thirs and forth items etc. what I'm looking for is the ability to choose which items won't be displayed in the EditModeStarting event, according to another cell value in the same row that was pressed.