Reputation: 69
Hello I'm very new to WPF and binding, still trying to get the Hang of it. Currently I have a Datagrid bind to my ObservableCollections, But Now I want to bind my Autocompletebox to a column of the Datagrids but it's not binding correctly. If I may get some guidance to how to Display PaymentNo from the Datagrid into Autocompletebox that would be greatly appreciated.
Think this may be the only Code needed
for (int iIndex = 1; iIndex <= totalpayments; ++iIndex)
{
PaymentInfo paymentInfo = new PaymentInfo();
paymentInfo.PaymentNo = iIndex;
paymentInfo.Date = date.AddMonths(iIndex);
paymentInfo.Balance = Math.Round(CalculateBalance(iIndex), 2);
paymentInfo.Payment = Math.Round(Payment, 2);
paymentInfo.Interest = Math.Round(CalculateInterestPart(iIndex), 2);
paymentInfo.Principle = Math.Round(CalculatePrinciple(iIndex), 2);
Payments.Add(paymentInfo);
}
On the Xaml Side
<DataGrid Grid.Row="1" ItemsSource="{Binding Payments}" Grid.RowSpan="2"/>
<telerik:RadAutoCompleteBox HorizontalAlignment="Left" Grid.Column="1" Grid.Row="6" VerticalAlignment="Top" ItemsSource="{Binding Payments.PaymentNo}"/>
I believe it has to do with ItemsSource="{Binding Payments.PaymentNo}
Upvotes: 0
Views: 417
Reputation: 12410
Try this
<telerik:RadAutoCompleteBox ItemsSource="{Binding Payments}" DisplayMemberPath="PaymentNo" TextSearchPath="PaymentNo"/>
Key is TextSearchPath
which according to telerik docs will filter "The name or path of the property that is used when filtering for each the data item in the control."
Upvotes: 1