I'm fighting hardly against the INotifyPropertyChanged and similars...
I managed to bind the height of a simple rectangle to the value incremented on the base of a timer. (the rectangle grows while the time is passing)..
Now what i should do is to bind 5 different rectangles to 5 different float values changing continuosly inside a List
I couldn't do that, but the main thing i noted is that if i set in my class:
---------------------------------------------
private List
public List
{
get { return _flowValuesSplitter; }
set
{
if (_flowValuesSplitter != value)
{
_flowValuesSplitter = value;
OnPropertyChanged("Value");
}
}
}
(I implemented the OnpropertyChanged... )
what i discovered is that when i Initialize the List
the code enters in the setter of the Property, but when later i do:
for (int s = 0; s < FlowValuesSplitter.Count; s++)
{
FlowValuesSplitter[s] += (float)(6.7);
}
the code doens't enter in the property setter...
Did i miss smt basic????
thanks, I.
VulpesPosted May 26, 2011, 10:48 AM
IvanPosted May 26, 2011, 11:02 AM
IvanPosted May 26, 2011, 10:43 AM
anyway my doubt remains...
I mean if i have a property defined public List
{
get ...
set...
}
and later i defined myList = new List
when i do myList[0] = 5.4 it doens't enter...
Now, let's leaving out the propertyChanged, ..... why it doens't enter in the the property setter when i change the values?
Posted May 26, 2011, 10:35 AM
By using the above statment you're are creating a (collection variable) Collection of float variable to store in the float values.
Here there is no relationship between your property as well the FlowValuesSplitter variable.
What you can do it, create an instance for your class then you can assign the your property value to the variable then your onpropertychanged method will work.
try this.
List
WindowsFormsApplication1.Class1 c = new Class1();
c.FlowValuesSplitter = FlowValuesSplitter;
Inside the class1 ,I have the property(FlowValuesSplitter) , in the form i have created the list of float varibles.
Once you assigned the value, the propertychange event will work,
hope this helps you.
IvanPosted May 26, 2011, 10:22 AM
Posted May 26, 2011, 10:16 AM
if(_flowValuesSplitter !=value)
{
}