I've searched for hours and could not find any existing solutions to the problem I'm having. So here it is please help if you can. When I bind the combobox SelectedValuePath I am seeing BindingExpression path errors in the output window:
System.Windows.Data Information: 41 : BindingExpression path error: 'GeoUnitID' property not found for 'object' because data item is null. This could happen because the data provider has not produced any data yet. BindingExpression:Path=GeoUnitID; DataItem=null; target element is 'ComboBox' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Information: 20 : BindingExpression cannot retrieve value due to missing information. BindingExpression:Path=GeoUnitID; DataItem=null; target element is 'ComboBox' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Information: 21 : BindingExpression cannot retrieve value from null data item. This could happen when binding is detached or when binding to a Nullable type that has no value. BindingExpression:Path=GeoUnitID; DataItem=null; target element is 'ComboBox' (Name=''); target property is 'NoTarget' (type 'Object')
System.Windows.Data Information: 10 : Cannot retrieve value using the binding and no valid fallback value exists; using default instead. BindingExpression:Path=GeoUnitID; DataItem=null; target element is 'ComboBox' (Name=''); target property is 'NoTarget' (type 'Object')
The binding does work correctly, and the correct values are displayed, but I suspect these errors are the reason for the poor performance I am seeing (scrolling/loading timing). Here's the relevant xaml:
<ListView x:Name="lvItems" Grid.Row="1" Grid.Column="0"
ItemsSource="{Binding ElementName=myWindow, Path=Items, Mode=TwoWay}"
gisc:ListViewSort.IsSortable="True">
<ListView.View>
<GridView>
<GridView.Columns>
<!-- selecteditembinding: source:Int32, dest:dest:Int16 -->
<GridViewColumn>
<GridViewColumnHeader Tag="CountryOfIssue" Content="CountryOfIssue" />
<GridViewColumn.CellTemplate>
<DataTemplate>
<Grid>
<ComboBox
ItemsSource="{Binding ElementName=myWindow, Path=Countries}"
SelectedValuePath="GeoUnitID"
SelectedValue="{Binding Path=CountryOfIssueID, Mode=TwoWay}"
DisplayMemberPath="ShortName"
Style="{StaticResource GridEditStyle}" />
</Grid>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView.Columns>
</GridView>
</ListView.View>
</ListView>
I've verified the ItemsSource collection does not have null items. I've also tried an entirely different structure (WPF datagrid instead of the Listview/Gridview structure shown above with similar results). The scrolling performance is terrible for a small number of rows (~400). I initially searched for ways to improve scrolling performance, but those solutions did little to help. There are TONS of these binding errors so I strongly suspect that is the root cause. Thanks for any help!
Aucun commentaire:
Enregistrer un commentaire