Hi,
Here i am using xamgrid to take data from the user.
In that my first coumn should have comboBoxes from which user can select the item. How to place
comboBox within first column cell.
Please give me some suggestions.
also if the user clicks add button means it have to provide new row with again combobox in the first coumn
retaining old row.
Thank You!!!
Hello,
To have a XamComboEdit, you have to set the EditorStyle of that field like this:
<igDP:Field Name="State" Label="Status">
<igDP:Field.Settings>
<igDP:FieldSettings EditorStyle="{StaticResource StatusFieldStyle}" />
</igDP:Field.Settings>
</igDP:Field>
...
<Style x:Key="StatusFieldStyle" TargetType="{x:Type igEditors:XamComboEditor}">
<Setter Property="ItemsProvider" Value="{StaticResource StatusItemsProvider}" />
</Style>
You can see an example of this in the XamFeatureBrowser, which is installed together with the components.
For your second requirement - adding new row, you have to add in the DataSource a new object of your underlying class (if you bind to a Collection) or a new DataRow in your table (if you bind to a DataTable).
Hope this helps,
Alex.
I have already crated comboboxesw in the first column.And it is binding to xmldata also.I can also select the
items in the combobox.
But it is not updating to the xml file.
I have given the code...
DataRecord
data = xamDataGrid1.ActiveRecord as DataRecord;
string rolename = data.Cells["RoleName"].Value.ToString();
Here RoleName is field name containg comboboxes..
How to update combobox contents to the xml file...
Thank You!
To the best of my knowledge, the grid would not commit changes by itself - it is not two-way binding. You would have to implement Update Changes method yourself.
I have already wrote method for updating.Remaining 2 fields values i am able to retreive .
But the field which is having combobox populated with xml data....
If a select combobox item active record is not taking the combobox selected item.
It showing null and remaining field values it is taking...and updating in xml file also.
It is updating null value instead of updating with combobox selected item.
i m placing combobox in the field using cellvaluepresenter style here.
so how to take tat cell value which is having combobox.
How to retreive selected combobox item into xamgrid1.active record.
string
Onsite = data.Cells["Onsite"].Value.ToString();
string Offshore = data.Cells["Offshore"].Value.ToString();
Well,
in this case you can use the Infragistics.Windows.Utilities.GetDescendantFromType() method and give as parameters the CellValuePresenter, typeof(XamComboEditor),false to get the XamComboEditor and get the SelectedValue property.
However, we recommend using the EditorType as my previous post:
This way, you will be able to get the Value of that cell.
Let me know if you have any questions on this:
Here is a sample code snippet:
First you have to get the desired CellValuePresenter and then use this as parent object of that method.
CellValuePresenter cvp = CellValuePresenter.FromCell(xamDataGrid1.ActiveCell);
var a = Infragistics.Windows.Utilities.GetDescendantFromType(cvp, typeof(XamTextEditor), false);
MessageBox.Show(a.ToString());
David,
This is true, the CellValuePresenter is not generated yet. You can only access the values of the record but not the cellvaluepresenter. As I can see from your other post here I think it is best to use the Loaded mode of your editor to perform custom initial logic and RecordUpdated event.
You can use SummaryResultChanged event and access the summary results like this:
xamDataPresenter1.FieldLayouts[0].SummaryDefinitions...
I have to get the sum value of third field , in order to check user inputs.
How to access suggest me..
Thank You!!
Hi Alex,
I want to access the summary result in my code to validate the input from the user.
How to access the summary result i.e., sum value in my case.
And also my grid contains multiple rows.
Can u suggest some code.
Thank You!!!!!!!
void XamDataGrid_InitializeRecord(object sender, InitializeRecordEventArgs e)
{
DataRecord dr = e.Record as DataRecord;
dr.IsActive = true;
for (int i = 0; i < dr.FieldLayout.Fields.Count; i++)
Cell cell = dr.Cells[i];
cell.IsActive = true;
Cell cell = m_GridControl.XamDataGrid.ActiveCell;
CellValuePresenter cvp2 = CellValuePresenter.FromCell(cell);
Here, cvp2 is still null. I tried setting the DataRecord to Active and tried setting the Cell to active before calling CellValuePresenter.FromCell method but still no luck. All I want to do here is get back the CellValuePresenter for the current field. Why does CellValuePresenter.FromCell or CellValuePresenter.FromRecordAndField return null? Do you think perhaps it may be due to the Cell not being rendered yet after binding the observable collection to the grid?
Thanks,
David