Mouse, as you know it, is a static class. It has a static property called Mouse.Position
. That property, is updated dynamically (binded to mouse, maybe??). (I've read the Mouse documentation in msdn)
I need to build a same class with this scenario.
I am making an application which able to have multiple pages, and each of the pages shared, for example, Margin
value.
There're 2 options (I think) to do it :
- Make a field in "page" class, and pass the value via constructor (easiest)
- Static class, similar to
Mouse.Position
usage, but, in this case, for example,PageInformation.Margin
(PageInformation
is a class, not a property nor a field)
I prefer the second option since it's easier to debug (i guess), and make the Page class cleaner, codeless, and easier during update if the Margin somehow changed by the user..
Anyone know how to do it? (mvvm way preferred)
Thanks.
UPDATE : P.S. I already understand the basic mvvm practice (INPC and such)
This is the general code so far in my application :
public class ViewModel : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
...
}
public class SheetPage : ViewModel
{
...
}