I want to bind a XamComboEditor to a Cell, where each cell in a row has a different set of data in the combobox, in C# code.
I use a ComboBoxItemsProvider, Fieldsetting and style to set a fieldsetting of a particular cell, through the 'InitializeRecord' event.
But that settings is used for the hole column (or Field for that matter).
Conclusion i get the same data on every row (in de particular column).
In the XamComboEditor dependeny properties is a loaded event, is it possible though that to set the correct XamComboEditor data and how?
Hi Poka
I do not follow what you are asking. Can you provide more information please.
Kind regards
Christo
How ca i do in visual basic
I have xamcomboeditor.itemsource = Lista -- have array it´s ok but when i want to put name and value it´s not working
xamcomboeditor.DisplayMemberPath ="memdescripcion"
xamcomboeditor.DisplayValueSource = "memid"
can you explain me thanks.
WOW, that was quick
I had an idea like that, but after reading through some of the other forums, I got the idea of just adding when the control initializes. So what I did was the following
<XAML>
<igEditors:ComboBoxItemsProvider x:Key="comboBox_FKActions" />
[... Some other code ...]
<igDP:XamDataGrid x:Name="XamDataGrid"[.... Some other code ....]
[... bla bla bla ...]
<igDP:Field Name="FKAction" Label="Actions"> <!--A setter is added to limit the options the user has--> <igDP:Field.Settings> <igDP:FieldSettings EditorType="{x:Type igEditors:XamComboEditor}"> <igDP:FieldSettings.EditorStyle> <Style TargetType="{x:Type igEditors:XamComboEditor}"> <Setter Property="ItemsProvider" Value="{StaticResource comboBox_FKActions}" /> </Style> </igDP:FieldSettings.EditorStyle> </igDP:FieldSettings> </igDP:Field.Settings> </igDP:Field>
</XAML>
[C#]
public RolesTab() { InitializeComponent(); _dt_Action = _bll_Action.GetActions(); ComboBoxItemsProvider statusProvider = this.TryFindResource("comboBox_FKActions") as ComboBoxItemsProvider; foreach (SecurityDAL.ac_ActionRow row in _dt_Action.Rows) { statusProvider.Items.Add(new ComboBoxDataItem(row.IDAction, row.Action_Code + " - " + row.Action_Description)); } }
Where the _bll_Action just returns a data table.
Hope this might help somone else trying this.
Regards
Hello Christo,
For this it would be appropriate to create a style the ComboBoxItemProvider and re-template it ( make a custom DataTemplate ) with two TextBoxes inside it, so that you can bind the code and description to each of them.
Hope this helps.
Hi Bastian.
If I understand you correctly, it might have the same reqest. I want to bind two fields to the same cell. I want to bind the Code and the Description of an action from my db into the same "line" in the dropdown.
So lets say the code is "WF_CA" and the Description is "Where Failure corrective action", then I want the ComboBoxItemsProvider to provide the cell with "WF_CA - Where Failure corrective action" and the user only selects that. The ValuePath should still link to the ID of the action.
I'm sorry I am not able to help you.