Hello,
I have a XamDataGrid which have a checkbox inside its ControlTemplate, On a button (outside the grid)click,how can I access the check box?
Can you please let me know its possible or not asap,if then please give me a sample.
TIA
Vivek
Hello Vivek,
Thank you for your post. I have been looking through it and I suggest you use the following code on order to access the ActiveRecord’s CheckBox:
DataRecordPresenter recpresenter = DataRecordPresenter.FromRecord(AvailableBookGrid.ActiveRecord) as DataRecordPresenter; CheckBox cb = Utilities.GetDescendantFromName(recpresenter, "SelectionCheckbox") as CheckBox;
Looking forward for your reply.
Stefan,
Am getting Exception as "AvailableBookGrid.ActiveRecord" is null,I tried
DataRecordPresenter.FromRecord(AvailableBookGrid.FieldLayouts[0].DataPresenter.Records[0])
as DataRecordPresenter; too but its also throwing Error.
Do you have anyother approach for getting checkbox ?
I was able to get individual checkboxes using
DataRecordPresenter recpresenter = DataRecordPresenter.FromRecord(AvailableBookGrid.ViewableRecords[0]) as DataRecordPresenter;
CheckBox cb = Utilities.GetDescendantFromName(recpresenter, "SelectionCheckbox") as CheckBox;
But how to remove parent checkbox?
I assume you have made a style for the HeaderPrefixArea in which you put a checkbox. If so, just remove that style and the area will look regular, if not would you please provide me with some isolated sample so I can investigate it further for you.