Click here to Skip to main content
15,898,036 members
Home / Discussions / C#
   

C#

 
AnswerRe: C# OOP: sub-property? PinPopular
Pete O'Hanlon11-Aug-11 5:23
mvePete O'Hanlon11-Aug-11 5:23 
AnswerRe: C# OOP: sub-property? Pin
PIEBALDconsult15-Aug-11 3:05
mvePIEBALDconsult15-Aug-11 3:05 
QuestionOpen web page from C# WinForms Pin
dipuks11-Aug-11 4:09
dipuks11-Aug-11 4:09 
AnswerRe: Open web page from C# WinForms Pin
Eddy Vluggen11-Aug-11 6:18
professionalEddy Vluggen11-Aug-11 6:18 
QuestionIssues in using Observable<T> to fire Property notification events (WinForms) [modified] Pin
BillWoodruff11-Aug-11 3:45
professionalBillWoodruff11-Aug-11 3:45 
AnswerRe: Issues in using Observable<T> to fire Property notification events (WinForms) Pin
BobJanova11-Aug-11 22:27
BobJanova11-Aug-11 22:27 
GeneralRe: Issues in using Observable&lt;T&gt; to fire Property notification events (WinForms) Pin
BillWoodruff11-Aug-11 23:23
professionalBillWoodruff11-Aug-11 23:23 
GeneralRe: Issues in using Observable<T> to fire Property notification events (WinForms) Pin
BobJanova11-Aug-11 23:57
BobJanova11-Aug-11 23:57 
Unfortunately I'm not really that familiar with ObservableCollection, though I have used the Silverlight version (is it the same?).

If I understand you correctly, you want to get an event on the collection when a property of an element is changed (and notified through INotifyPropertyChanged on the element – T must implement INotifyPropertyChanged and fire the notification event for any method of having observer updates). The ObservableCollection explicitly implements the INotifyPropertyChanged interface, so yes, if that event is correctly fired when a member element is updated, you will need to cast the collection to hook it. I haven't tried it so I don't know if it works.

(I.e., does the event get fired in this test case, and if so are the arguments useful:
void Test(){
 var c = new ObservableCollection<Notifier>();
 ((INotifyPropertyChanged)c).PropertyChanged += (s,e) => MessageBox.Show("Property "+e.PropertyName+" on "+s+" updated");
 c.Add(new Notifier());
 
 c[0].NotificationProperty = 42;
}

class Notifier : INotifyPropertyChanged {
 public event PropertyChangedEventHandler PropertyChanged;
 public int NotificationProperty {
  get { return notificationProperty; }
  set { notificationProperty = value; PropertyChanged(this, "NotificationProperty"); }
 }
}

)

The fact that they made that interface implementation explicit and force the cast implies they probably aren't expecting you to use it in this way, but if the event is fired when properties on the elements change and that is useful to you, I don't see a problem with using it in that fashion.
GeneralRe: Issues in using Observable to fire Property notification events (WinForms) Pin
BillWoodruff12-Aug-11 12:27
professionalBillWoodruff12-Aug-11 12:27 
GeneralRe: Issues in using Observable<T> to fire Property notification events (WinForms) Pin
Pete O'Hanlon12-Aug-11 0:15
mvePete O'Hanlon12-Aug-11 0:15 
GeneralRe: Issues in using Observable to fire Property notification events (WinForms) Pin
BobJanova12-Aug-11 2:48
BobJanova12-Aug-11 2:48 
GeneralRe: Issues in using Observable to fire Property notification events (WinForms) Pin
BillWoodruff12-Aug-11 12:29
professionalBillWoodruff12-Aug-11 12:29 
Questionproblem with process.waitforexit(timeout) Pin
pprasanthk11-Aug-11 3:37
pprasanthk11-Aug-11 3:37 
AnswerRe: problem with process.waitforexit(timeout) Pin
Not Active11-Aug-11 4:27
mentorNot Active11-Aug-11 4:27 
GeneralRe: problem with process.waitforexit(timeout) Pin
pprasanthk11-Aug-11 5:41
pprasanthk11-Aug-11 5:41 
GeneralRe: problem with process.waitforexit(timeout) Pin
Not Active11-Aug-11 5:58
mentorNot Active11-Aug-11 5:58 
GeneralRe: problem with process.waitforexit(timeout) Pin
pprasanthk11-Aug-11 7:02
pprasanthk11-Aug-11 7:02 
GeneralRe: problem with process.waitforexit(timeout) Pin
Not Active11-Aug-11 7:32
mentorNot Active11-Aug-11 7:32 
GeneralRe: problem with process.waitforexit(timeout) Pin
pprasanthk11-Aug-11 7:05
pprasanthk11-Aug-11 7:05 
GeneralRe: problem with process.waitforexit(timeout) PinPopular
Pete O'Hanlon11-Aug-11 7:20
mvePete O'Hanlon11-Aug-11 7:20 
GeneralRe: problem with process.waitforexit(timeout) Pin
pprasanthk11-Aug-11 7:34
pprasanthk11-Aug-11 7:34 
GeneralRe: problem with process.waitforexit(timeout) Pin
thatraja11-Aug-11 7:43
professionalthatraja11-Aug-11 7:43 
GeneralRe: problem with process.waitforexit(timeout) Pin
pprasanthk11-Aug-11 7:45
pprasanthk11-Aug-11 7:45 
AnswerRe: problem with process.waitforexit(timeout) Pin
jschell11-Aug-11 13:09
jschell11-Aug-11 13:09 
GeneralRe: problem with process.waitforexit(timeout) Pin
pprasanthk11-Aug-11 17:57
pprasanthk11-Aug-11 17:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.