Hello,
I´m working with a xamgrid and I need to get the columns header text. Is that possible??
I´m working with a user control and I receive a object from another user control. I use me.Xamgrid.ItemsSource=object to visualize it.
The xamgrid columns are the object fields and i need to use this field names (the xamgrid columns header) but i can not work with the object.
Now i´m doing this
Try
Dim p() As PropertyInfo = xGrid.ActiveItem.GetType.GetProperties
For Each n As PropertyInfo In p
Dim valorPropiedad As Object = xGrid.ActiveItem.GetType().GetProperty(n.Name).GetValue(dataGrid.ActiveItem, Nothing)
Dim a As New FieldEditor(FieldEditor.TiposDatos.TBoolean, False, n.Name)
stkCustom.Children.Add(a)
Next
This n.name is what i need to recovery but i don`t want to have to make click in a row to have an active item.
If i could get the columns header text i wouldn´t need an active item
Thanks, you are doing a great work.
Sorry for my English.
David A.
I have been looking into you question and in order to get the headers text you can use:
Dim myText = XamGrid1.Columns(0).HeaderText
Please let me know if I can assist you further with this issue.
Sincerely,
Ekaterina
Developer Support Engineer
Infragistics, Inc.
www.infragistics.com/support
Hello Ekaterina,
XamGrid1.Columns(0).HeaderText is for set the text into the header.
I´m looking for get the header text.
Thank you for your support.
Sincerely
Thank you for your answer.
HeaderText property can either get or set the columns headers. In the given example the “myText” variable will get the needed value.
Please let me know if I misunderstood what you are looking or if you have any additional questions.
if i try to MessageBox.Show( XamGrid1.Columns(0).HeaderText) or
Dim myText = XamGrid1 .Columns(0).HeaderText
MessageBox.Show(myText)
an error happens: the value can not be null, parameter name: message box text.
sincerely,
Would you please try using
.Key instead of .HeaderText – this property should assure that there would not be a null value coming for that one.
I will be looking forward for receiving some feedback from you regarding the discussed matter.
.key works perfect.
Thank you so much for your support.
Ekaterina.