wpf - How to set property only on second column of a ListView? -
Introduction
I have a list view and only the second formatting Want column. The following XAML code does this:
& lt; ListView x: name = "listview" & gt; & Lt; ListView.View & gt; & Lt; GridView & gt; & Lt; GridViewColumn Header = "Property" DisplayMemberBinding = "{Binding Path = Key}" width = "100" /> & Lt ;! - & lt; GridViewColumn header = "value" DisplayMemberBinding = "{binding path = value}" width = "250" & gt; - & gt; & Lt; GridViewColumn header = "value" width = "250" & gt; & Lt; GridViewColumn.CellTemplate & gt; & Lt; DataTemplate & gt; & Lt; TextBlock Text = "{binding path = value}" foreground = "cornflowerblu" automation properties .name = "{binding path = key}" /> & Lt; / DataTemplate & gt; & Lt; /GridViewColumn.CellTemplate> & Lt; / GridViewColumn & gt; & Lt; / GridView & gt; & Lt; /ListView.View> & Lt; / ListView & gt;
I have a problem with the automation properties. The property is not being set property. I was checking it with the coded UI Test Builder and the property is empty. Text and foreground property are being set properly.
Question
Does anyone know that automation properties are not being set to name?
Additional information
Strange enough, set the following XAML code does set up automation properties. Name
& lt; ListView x: name = "list view" & gt; & Lt; ListView.Resources & gt; & Lt; Style TargetType = "TextBlock" & gt; & Lt; Setter Property = "Automation Properties .name" value = "{Binding key}" /> & Lt; / Style & gt; & Lt; /ListView.Resources> & Lt; ListView.View & gt; & Lt; GridView & gt; & Lt; GridViewColumn Header = "Property" DisplayMemberBinding = "{Binding Path = Key}" width = "100" /> & Lt; GridViewColumn header = "value" DisplayMemberBinding = "{binding path = value}" width = "250" /> & Lt; / GridView & gt; & Lt; /ListView.View> & Lt; / ListView & gt;
The problem here is that automation properties. The name is being set to all columns. But I only want it on the other because otherwise my coded UI test code incorrectly values it (first column, instead of the second column, which I want to do).
Do not know if you know about this, but to analyze these types of problems Very useful tool.
Specifically, it will highlight any data binding errors you receive (red).
I took a look at myself and it certainly seems like the first piece of xaml is working now (after you have cleaned the syntax error) in the snoop, the bound property highlight is green Are highlighted with
The snoop shown here is a screen shot that is being set correctly:
And here tapblocks (where the property is not set ... there is a screen shot of snoop, not showing a light green column) on the first column:
And, finally, I 'bound you to intentionally break the binding Doing Are you aware that something is wrong and you have a data binding error (this is highlighted in red and one of the columns gives you additional information):
Comments
Post a Comment