I have the following problem I have a lot of rectangles(or a paths) and I want to add a command to every rectangle, that when I click the rectangle an object will be fill with the values of the rectangle(color,name).And from the GUI I want to change the color of the rectangle when I execute the command How can I do that in MVVM?
For example I have an object Ractangle
public Class Rectangle{
String name;
开发者_如何学运维 String color;
public String Color{
get{ return color;}
set {color=value;}
OnPropertyChange(color);
}
public String Name{
get{ return name;}
set {name=value;}
OnPropertyChange(name);
}
I think it would be easier if you wrapped your Rectangle into a Button which gives you the readily usable Command property you can bind a command to. To be honest though I'm not 100% sure what you're after, please elaborate your scenario.
精彩评论