Hi,
I am using an AutoCompleteBox inside a RadDataForm template.The control ItemsSource is bound to an ObseravableCollcetion while the selected item is bound to a property on the window.
Now, the breakpoint I set in the 'set' part of the SelectedDriver property is not hit.I also find it to be null when sending the form data for saving:
Thanks
Madani
I am using an AutoCompleteBox inside a RadDataForm template.The control ItemsSource is bound to an ObseravableCollcetion while the selected item is bound to a property on the window.
<
DataTemplate
x:Key
=
"MyTemplate"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
/>
<
RowDefinition
/>
<
RowDefinition
/>
<
RowDefinition
/>
<
RowDefinition
/>
<
RowDefinition
/>
<
RowDefinition
/>
</
Grid.RowDefinitions
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"200"
/>
<
ColumnDefinition
Width
=
"*"
/>
</
Grid.ColumnDefinitions
>
<
Label
Content
=
"Driver"
Grid.Row
=
"0"
/>
<
Label
Content
=
"Document Number"
Grid.Row
=
"1"
/>
<
Label
Content
=
"Issue Date"
Grid.Row
=
"2"
/>
<
Label
Content
=
"Expiry Date"
Grid.Row
=
"3"
/>
<
Label
Content
=
"Place of Issue"
Grid.Row
=
"4"
/>
<
Label
Content
=
"Document Type"
Grid.Row
=
"5"
/>
<
Label
Content
=
"Remarks"
Grid.Row
=
"6"
/>
<
telerik:RadAutoCompleteBox
AutoCompleteMode
=
"Suggest"
TextSearchPath
=
"FullName"
ItemsSource
=
"{Binding Drivers,ElementName=DriverDocumentView1}"
Name
=
"RadAutoCompleteBox"
SearchTextChanged
=
"RadAutoCompleteBox_SearchTextChanged"
TextSearchMode
=
"Contains"
SelectionMode
=
"Single"
DisplayMemberPath
=
"Name"
SelectedItem
=
"{Binding SelectedDriver,ElementName=DriverDocumentView1}"
Grid.Column
=
"1"
Grid.Row
=
"0"
/>
<
TextBox
Text
=
"{Binding Document.DocumentNo}"
Grid.Row
=
"1"
Grid.Column
=
"1"
/>
<
DatePicker
SelectedDate
=
"{Binding IssueDate}"
Grid.Row
=
"2"
Grid.Column
=
"1"
/>
<
DatePicker
SelectedDate
=
"{Binding ExpiryDate}"
Grid.Row
=
"3"
Grid.Column
=
"1"
/>
<
ComboBox
ItemsSource
=
"{Binding PlacesOfIssue,ElementName=DriverDocumentView1}"
DisplayMemberPath
=
"Text"
SelectedValuePath
=
"ID"
SelectedValue
=
"{Binding Document.PlaceOfIssueID}"
Grid.Column
=
"1"
Grid.Row
=
"4"
/>
<
ComboBox
ItemsSource
=
"{Binding DocumentTypes,ElementName=DriverDocumentView1}"
DisplayMemberPath
=
"Name"
SelectedValuePath
=
"ID"
SelectedValue
=
"{Binding Document.DocumentTypeID}"
Grid.Column
=
"1"
Grid.Row
=
"5"
/>
<
TextBox
Text
=
"{Binding Remarks}"
Grid.Row
=
"6"
Grid.Column
=
"1"
/>
</
Grid
>
</
DataTemplate
>
private
Driver selectedDriver;
public
Driver SelectedDriver
{
get
{
return
selectedDriver; }
set
{ selectedDriver = value; NotifyPropertyChanged(
"SelectedDriver"
); }
}
Now, the breakpoint I set in the 'set' part of the SelectedDriver property is not hit.I also find it to be null when sending the form data for saving:
private
void
SaveBTN_Click(
object
sender, RoutedEventArgs e)
{
if
(RadDataForm.ValidateItem())
{
DriverDocument driverDocument = RadDataForm.CurrentItem.To<DriverDocument>();
driverDocument.Document.CreationDate = DateTime.Now;
driverDocument.Document.EntryByID = 178;
driverDocument.Driver = SelectedDriver;
RadDataForm.SubmitChanges();
}
}
Thanks
Madani