Well, this is somewhat related to this question: WPF Printing multiple pages from one view model
I tried to follow the advice given there, but now I'm stuck.
My application uses MainView.xaml and the corresponding MainViewViewModel.cs, I use MVVM Light in the background.
Now - according to the post - it seems I need to do the following:
- Create custom control
- Derive some properties from a user control
- Verify that the view model displays these properties.
The idea is clear, but I'm stuck trying to notify each other.
My user control (UcTest.xaml) provides a dependency property:
public string SpecialText
{
get { return (string)GetValue(SpecialTextProperty); }
set
{
SetValue(SpecialTextProperty, value);
}
}
public static readonly DependencyProperty SpecialTextProperty =
DependencyProperty.Register("SpecialText", typeof(string), typeof(UcTest), new PropertyMetadata(new PropertyChangedCallback(SpecialTextChangedPropertyCallback)));
private static void SpecialTextChangedPropertyCallback(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
Debug.WriteLine("Ffgdgf");
}
, , . , ViewModel (, ).
, :
- ViewModel UserControl, ?
- ?
โ 1:
() , : . UserControl1 ( ViewModel UserControl1) MainViewViewModel.