Click here to Skip to main content
15,888,269 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: UserControl Pin
Richard Deeming6-Dec-16 2:10
mveRichard Deeming6-Dec-16 2:10 
GeneralRe: UserControl Pin
Kevin Marois6-Dec-16 4:47
professionalKevin Marois6-Dec-16 4:47 
QuestionC# WPF listbox binding to selected item does not update my property Pin
Member 128805954-Dec-16 5:54
Member 128805954-Dec-16 5:54 
AnswerRe: C# WPF listbox binding to selected item does not update my property Pin
Richard Deeming5-Dec-16 1:58
mveRichard Deeming5-Dec-16 1:58 
GeneralRe: C# WPF listbox binding to selected item does not update my property Pin
Member 128805955-Dec-16 9:08
Member 128805955-Dec-16 9:08 
GeneralRe: C# WPF listbox binding to selected item does not update my property Pin
Jon McKee5-Dec-16 10:59
professionalJon McKee5-Dec-16 10:59 
GeneralRe: C# WPF listbox binding to selected item does not update my property Pin
Member 128805956-Dec-16 7:38
Member 128805956-Dec-16 7:38 
GeneralRe: C# WPF listbox binding to selected item does not update my property Pin
Jon McKee6-Dec-16 8:23
professionalJon McKee6-Dec-16 8:23 
The whole point of my post was to remove the re-assignment. Unless you want to implement your own CollectionChanged event to cover the re-assignment, the default CollectionView won't know the collection was modified. I forgot to change the null assignment in your if-statement. Also, you should instantiate in your constructor.
C#
public MainViewModel()
{
    ContactList = new ObservableCollection<Contact>(cbdc.Contacts);
    //Add this
    ConversationList = new ObservableCollection<Conversation>();
    //--------
    SelectedContact = ContactList.FirstOrDefault();
    PopulateConversationList();
}

public void PopulateConversationList()
{
if (selectedContact == null)
{
    //Change ConversationList = null; to this
    ConversationList.Clear();
}
else
{
    var conversations = from c in cbdc.Conversations
                        where c.ContactID == SelectedContact.Id
                        select c;

    ConversationList.Clear();

    foreach (Conversation c in conversations)
    {
        ConversationList.Add(c);
    }
}

If you really want to remake the collection each time you can but you will have to implement INotifyCollectionChanged to cover your re-assignment which is not as friendly as INotifyPropertyChanged. That's a lot of extra mess when you can simply re-use the collection like this.
GeneralRe: C# WPF listbox binding to selected item does not update my property Pin
Member 128805956-Dec-16 9:10
Member 128805956-Dec-16 9:10 
GeneralRe: C# WPF listbox binding to selected item does not update my property Pin
Jon McKee6-Dec-16 10:30
professionalJon McKee6-Dec-16 10:30 
GeneralRe: C# WPF listbox binding to selected item does not update my property Pin
Member 128805957-Dec-16 8:10
Member 128805957-Dec-16 8:10 
GeneralRe: C# WPF listbox binding to selected item does not update my property Pin
Jon McKee5-Dec-16 10:13
professionalJon McKee5-Dec-16 10:13 
AnswerRe: C# WPF listbox binding to selected item does not update my property Pin
Gerry Schmitz5-Dec-16 5:51
mveGerry Schmitz5-Dec-16 5:51 
GeneralRe: C# WPF listbox binding to selected item does not update my property Pin
Member 128805955-Dec-16 9:10
Member 128805955-Dec-16 9:10 
QuestionTabControl views are not disposed Pin
Leif Simon Goodwin23-Nov-16 4:55
Leif Simon Goodwin23-Nov-16 4:55 
AnswerRe: TabControl views are not disposed Pin
Pete O'Hanlon23-Nov-16 5:30
mvePete O'Hanlon23-Nov-16 5:30 
PraiseRe: TabControl views are not disposed Pin
Leif Simon Goodwin23-Nov-16 21:09
Leif Simon Goodwin23-Nov-16 21:09 
QuestionIs there any way to automate the silverlight application using Eclipse-testng-selenium-java frameowork Pin
Ashish khanduri20-Nov-16 18:23
Ashish khanduri20-Nov-16 18:23 
AnswerRe: Is there any way to automate the silverlight application using Eclipse-testng-selenium-java frameowork Pin
Mycroft Holmes20-Nov-16 19:39
professionalMycroft Holmes20-Nov-16 19:39 
GeneralRe: Is there any way to automate the silverlight application using Eclipse-testng-selenium-java frameowork Pin
Ashish khanduri20-Nov-16 19:50
Ashish khanduri20-Nov-16 19:50 
QuestionSound Command that can intercept the Active Thread Pin
Vimalsoft(Pty) Ltd15-Nov-16 17:56
professionalVimalsoft(Pty) Ltd15-Nov-16 17:56 
AnswerRe: Sound Command that can intercept the Active Thread Pin
Gerry Schmitz16-Nov-16 6:07
mveGerry Schmitz16-Nov-16 6:07 
QuestionCan't Move Label with mouse in WPF Pin
Dadou5512-Nov-16 22:44
Dadou5512-Nov-16 22:44 
AnswerRe: Can't Move Label with mouse in WPF Pin
Richard Deeming14-Nov-16 2:13
mveRichard Deeming14-Nov-16 2:13 
QuestionHow to achieve grouping and ungrouping usercontrol in wpf application programmatically Pin
Pankaj Deharia10-Nov-16 3:05
professionalPankaj Deharia10-Nov-16 3:05 

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.