Hi,
I have XamDataPresenter, we are binding this XamDataPresenter with XML file and data is displaying in Tabular form, My problem is that while right click on any Row( Record), i didn't get Row(Record value), Actually my requirement is that when rigth click on any row i want row index, so i can get any column value on that bases of that index value.
Thanks,
Ajay
Hi Custis,
As we discussed, sharing the solution of the problem mentioned above by me..
Problem inshort: When we bind any object(which is not a string) to DataGrid field, the field not remains sortable.
Solution: Create an UnBound Field and set Binding to it as follows.
<InfraGrid:UnboundField BindingPath="[ObjectName].[PropertyName]" Label="Preferred Description" Width="480">
In my case I had a Colloection as a datasource. The collection was of class which has a field of type RecordType. When I bind the colloection to a DataGrid, RecordType field gets assigned to one of the fields. As I override ToString method of RecordType class and returned RecordName, I could see the RecordNames in the field but cound not sort the field. When I used Unbound field and explicitely set the BindingPath to the RecordName, I cound see the RecordNames in the field as well as could sort the field.
There is a better way (probably from Alex Fidanov):private void ContextMenuOpening(object sender, ContextMenuEventArgs e){ var element = e.OriginalSource as FrameworkElement; if (element != null) { var record = element.DataContext as DataRecord; if (record == null) { var editor = element as XamTextEditor; if (editor != null) { record = editor.Host.DataContext as DataRecord; } } if (record != null) { var grid = sender as XamDataGrid; record.IsSelected = true; record.IsActive = true; grid.ActiveRecord = record; } }
Hello Chetan,
I received your sample. I will get back to you as soon as I determine what the problem is and will communicate the solution here for other users as well.
Thank you!
I tried following but not working.
EditAsType="{x:Type Sys:String}" on FieldSettings
can I try anything else to solve the issue?
Hi Curtis,
Sent you an email with the sample application attached.
Please let me know if you need more details about the issue.
Chetan