Hello,
I have a Day.cs class who have this propriety :
public ObservableCollection ListeTache
{
get { return this._listeTache; }
set
{
_listeTache = value;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("ListeTache"));
}
}
}
public string Notes
{
get { return this._notes; }
set
{
_notes = value;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("Notes"));
}
}
}
public bool Enabled
{
get { return _enabled; }
set
{
_enabled = value;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("Enabled"));
}
} }
My Day.cs class have :
public Day(){
_listeTache = new ObservableCollection();
_listeTache.CollectionChanged += ListeTache_Changed;
}
private void ListeTache_Changed(object sender, NotifyCollectionChangedEventArgs e)
{
MessageBox.Show("ok");
}
I bind Notes like that :
<TextBox IsEnabled="{Binding IsEnabled}" Text="{Binding Notes, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" AcceptsReturn="True" TextWrapping="Wrap" BorderThickness="0" ScrollViewer.VerticalScrollBarVisibility="Auto" removed="{x:Null}" Foreground="White" />
I bind ListeTache like that :
<ListBox x:Name="ListeTaches" IsEnabled="{Binding IsEnabled}" ItemsSource="{Binding ListeTache}" IsSynchronizedWithCurrentItem="True" FontSize="10" PreviewMouseDown="PreviewMouseDownClick_clear" MouseDoubleClick="doubleClic">
<Style.Triggers>
In my class Calendar.cs I have this event :
private void Day_Changed(object sender, PropertyChangedEventArgs e)
{
if (DayChanged == null)
{
return;
}
DayChanged(this, new DayChangedEventArgs(sender as Day));
}
I use my Generic.xaml in other projet like that :
<Scan:Calendar x:Name="Calendar" DayChanged="Calendar_DayChanged" Margin="0,82,0,0" HorizontalContentAlignment="Center"/>
When I start this app for the first time I receive my message "ok" for each items already in ListeTache.
After starting, When I change the propriety "Notes", the event is fire and it's okay but when I add or Remove an element in my ListeTache I never get an event.
How can I do ? Thanks in advance for your reply guys.