У меня есть пользовательский элемент управления для навигации по данным в Silverlight, который открывает дочернее окно, в котором пользователь может ввести критерии поиска, и когда они нажимают «Применить», предполагается, что необходимо обновить связанное свойство в ViewModel (шаблон MVVM).
Ссылки: SearchDialog ‹--> DataNavigator ‹--> MyView ‹--> MyViewModel
Свойство зависимости в SearchDialog, кажется, работает, когда я устанавливаю его значение, оно отображается в DataNavigator; однако, когда свойство зависимости изменяется, кажется, что никакое уведомление не отправляется из DataNavigator в MyView / MyViewModel.
SearchDialog является производным от ChildWindow:
public string Search
{
get { return (string)GetValue(SearchProperty); }
set { SetValue(SearchProperty, value); }
}
public static readonly DependencyProperty SearchProperty =
DependencyProperty.Register("Search", typeof(string), typeof(SearchDialog),
new PropertyMetadata(null));
DataNavigator является производным от UserControl:
public Binding Search { get; set; }
private void DataNavigator_Loaded(object sender, Windows.RoutedEventArgs e)
{
if (Search != null)
this._searchDialog.SetBinding(SearchDialog.SearchProperty, Search);
}
MyView является производным от SilverlightFX.UserInterface.Navigation.Page:
<DataNavigator MovePreviousAction="$model.MovePrevious()"
CurrentIndex="{Binding CurrentIndex, Mode=TwoWay}"
MoveNextAction="$model.MoveNext()"
SaveAction="$model.SaveChanges()"
IsLoading="{Binding IsLoading, Converter={StaticResource VisibilityConverter}}"
Search="{Binding SearchString, Mode=TwoWay}"/>
MyViewModel происходит от ViewModel:
public string SearchString
{
get { return this._search; }
set
{
if(value != this._search)
{
this._search = value;
this.RaisePropertyChanged("SearchString");
}
}
}
Я часами пытался найти проблему, но безуспешно; кто-нибудь видит проблему? Заранее спасибо,