{"id":10066,"date":"2023-09-30T09:36:14","date_gmt":"2023-09-30T09:36:14","guid":{"rendered":"https:\/\/putridparrot.com\/blog\/?p=10066"},"modified":"2023-09-30T09:36:14","modified_gmt":"2023-09-30T09:36:14","slug":"i-want-row-automation-ids-on-my-xamdatagrid","status":"publish","type":"post","link":"https:\/\/putridparrot.com\/blog\/i-want-row-automation-ids-on-my-xamdatagrid\/","title":{"rendered":"I want row automation id&#8217;s on my XamDataGrid&#8230;"},"content":{"rendered":"<p>As part of work I&#8217;m doing at the moment, building a UI automation API for our testers. I continually come across issues around data grid controls and access the rows within it (we&#8217;re primarily using XamDataGrids from Infragistics). <\/p>\n<p>What I need is to have an AutomationId reflecting some form of index in the grid. Good news is we can do this&#8230;<\/p>\n<p>If we take a XamaDataGrid and create a style such as this<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&lt;Style x:Key=&quot;RowPresenterStyle&quot; TargetType=&quot;igDP:DataRecordPresenter&quot;&gt;\r\n  &lt;Setter Property=&quot;AutomationProperties.AutomationId&quot; Value=&quot;{Binding DataItemIndex}&quot; \/&gt;\r\n&lt;\/Style&gt;\r\n<\/pre>\n<p>and now in the XamDataGrid&#8217;s FieldLayoutSettings we can apply this style using<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&lt;igDP:XamaDataGrid.FieldLayoutSettings&gt;\r\n  &lt;igDP:FieldLayoutSettings\r\n     &lt;!-- Other settings --&gt;\r\n     DataRecordPresenterStyle=&quot;{StaticResource RowPresenterStyle}&quot; \/&gt;\r\n&lt;\/igDP:XamaDataGrid.FieldLayoutSettings&gt;\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>As part of work I&#8217;m doing at the moment, building a UI automation API for our testers. I continually come across issues around data grid controls and access the rows within it (we&#8217;re primarily using XamDataGrids from Infragistics). What I need is to have an AutomationId reflecting some form of index in the grid. Good [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[13,85],"tags":[],"class_list":["post-10066","post","type-post","status-publish","format-standard","hentry","category-wpf","category-xamdatagrid"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/10066","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/comments?post=10066"}],"version-history":[{"count":2,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/10066\/revisions"}],"predecessor-version":[{"id":10105,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/posts\/10066\/revisions\/10105"}],"wp:attachment":[{"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/media?parent=10066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/categories?post=10066"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/putridparrot.com\/blog\/wp-json\/wp\/v2\/tags?post=10066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}