Click here to Skip to main content
15,901,949 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: WPF - Why? Pin
Pete O'Hanlon11-Nov-14 20:46
mvePete O'Hanlon11-Nov-14 20:46 
QuestionProblem to synchronise two DataContext bound ComboBoxes Pin
Tom Rahav10-Oct-14 18:25
Tom Rahav10-Oct-14 18:25 
AnswerRe: Problem to synchronise two DataContext bound ComboBoxes Pin
Gerry Schmitz13-Oct-14 11:39
mveGerry Schmitz13-Oct-14 11:39 
GeneralRe: Problem to synchronise two DataContext bound ComboBoxes Pin
Tom Rahav13-Oct-14 14:39
Tom Rahav13-Oct-14 14:39 
QuestionDataGrid won't detect CTRL + C Pin
Mc_Topaz9-Oct-14 3:17
Mc_Topaz9-Oct-14 3:17 
AnswerRe: DataGrid won't detect CTRL + C Pin
Vincent Beek9-Oct-14 15:23
Vincent Beek9-Oct-14 15:23 
QuestionRe: DataGrid won't detect CTRL + C Pin
Mc_Topaz9-Oct-14 20:08
Mc_Topaz9-Oct-14 20:08 
AnswerRe: DataGrid won't detect CTRL + C Pin
Vincent Beek9-Oct-14 20:25
Vincent Beek9-Oct-14 20:25 
AnswerRe: DataGrid won't detect CTRL + C Pin
Hi I am Kevin29-Oct-14 6:05
Hi I am Kevin29-Oct-14 6:05 
QuestionViewBox Button alignment Pin
Member 102727486-Oct-14 10:00
Member 102727486-Oct-14 10:00 
AnswerRe: ViewBox Button alignment Pin
Mycroft Holmes6-Oct-14 14:21
professionalMycroft Holmes6-Oct-14 14:21 
QuestionDisplaying Validation Pin
cjb1102-Oct-14 21:49
cjb1102-Oct-14 21:49 
AnswerRe: Displaying Validation Pin
cjb1102-Oct-14 23:05
cjb1102-Oct-14 23:05 
QuestionReport Not Showing All Data Pin
Kevin Marois29-Sep-14 10:20
professionalKevin Marois29-Sep-14 10:20 
QuestionWPF Reporting Question Pin
Kevin Marois23-Sep-14 7:07
professionalKevin Marois23-Sep-14 7:07 
AnswerRe: WPF Reporting Question Pin
Bernhard Hiller23-Sep-14 21:56
Bernhard Hiller23-Sep-14 21:56 
GeneralRe: WPF Reporting Question Pin
Kevin Marois24-Sep-14 16:00
professionalKevin Marois24-Sep-14 16:00 
QuestionForm with ComboBoxes bound to the same source. Pin
cjb11016-Sep-14 2:45
cjb11016-Sep-14 2:45 
AnswerRe: Form with ComboBoxes bound to the same source. Pin
Pete O'Hanlon16-Sep-14 3:16
mvePete O'Hanlon16-Sep-14 3:16 
GeneralRe: Form with ComboBoxes bound to the same source. Pin
cjb11016-Sep-14 3:37
cjb11016-Sep-14 3:37 
GeneralRe: Form with ComboBoxes bound to the same source. Pin
Pete O'Hanlon16-Sep-14 6:25
mvePete O'Hanlon16-Sep-14 6:25 
GeneralRe: Form with ComboBoxes bound to the same source. Pin
cjb11017-Sep-14 22:05
cjb11017-Sep-14 22:05 
AnswerRe: Form with ComboBoxes bound to the same source. Pin
cjb11022-Sep-14 4:29
cjb11022-Sep-14 4:29 
AnswerSubscribing to the PropertyChangedEventHandler of a class in a List from the class holding the List (solved, sort of...) Pin
GuyThiebaut14-Sep-14 1:25
professionalGuyThiebaut14-Sep-14 1:25 
I have a NotificationInformation class which contains properties together with property changed events:

C#
public string EmailUser
{

    get { return _emailUser; }
    set
    {

        _emailUser = value;
        OnPropertyChanged("EmailUser");

    }

}


The NotificationInformationRepository class contains the NotificationInformation classes in a List of NotificationInformation classes (List<NotificationInformation>)

When OnPropertyChanged fires on a NotificationInformation instance I want to be able to serialize the NotificationInformationRepository data in the List.

I have the serialization working correctly - my question is how do I go about subscribing to or picking up the OnPropertyChanged events from within the NotificationInformationRepository class?
I realise this is a basic WPF question but I am feeling dumb this weekend being unable to code this.


-----------------------------------------------------------------------------------------------------
Solution:

In NotificationInformation I have declared a delegate:
C#
public delegate void ItemChanged();
[field: NonSerialized]
public ItemChanged ItemHasChanged;


public NotificationInformation(ItemChanged _itemChanged)
{

    ItemHasChanged = _itemChanged;

}


public string EmailUser
{

    get { return _emailUser; }
    set
    {

        _emailUser = value;
        OnPropertyChanged("EmailUser");
        ItemHasChanged();

    } 

}


When I add a NotificationInformation to the NotificationInformationRepository List I pass in a reference to a method in NotificationInformationRepository that is used as the delegate.

It's not pretty Frown | :(
“That which can be asserted without evidence, can be dismissed without evidence.”

― Christopher Hitchens

GeneralRe: Subscribing to the PropertyChangedEventHandler of a class in a List from the class holding the List (solved, sort of...) Pin
SledgeHammer0114-Sep-14 9:41
SledgeHammer0114-Sep-14 9:41 

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.