Click here to Skip to main content
15,908,776 members
Home / Discussions / WPF
   

WPF

 
QuestionHow to create video chat application in wpf????? Pin
harjindersingh28-Oct-09 0:48
harjindersingh28-Oct-09 0:48 
AnswerRe: How to create video chat application in wpf????? Pin
Christian Graus28-Oct-09 13:33
protectorChristian Graus28-Oct-09 13:33 
GeneralRe: How to create video chat application in wpf????? Pin
harjindersingh28-Oct-09 19:28
harjindersingh28-Oct-09 19:28 
QuestionHow to check all rows in DataGrid by clicking Check all Button in WPF in C# Pin
ChandrakanthGaddam27-Oct-09 0:48
ChandrakanthGaddam27-Oct-09 0:48 
AnswerRe: How to check all rows in DataGrid by clicking Check all Button in WPF in C# Pin
Pete O'Hanlon27-Oct-09 0:56
mvePete O'Hanlon27-Oct-09 0:56 
GeneralRe: How to check all rows in DataGrid by clicking Check all Button in WPF in C# Pin
ChandrakanthGaddam27-Oct-09 1:08
ChandrakanthGaddam27-Oct-09 1:08 
GeneralRe: How to check all rows in DataGrid by clicking Check all Button in WPF in C# Pin
Pete O'Hanlon27-Oct-09 1:36
mvePete O'Hanlon27-Oct-09 1:36 
QuestionReference to parent collection Pin
ausadmin26-Oct-09 19:38
ausadmin26-Oct-09 19:38 
Apologies in advance, I suspect there may be an obvious answer to this, but I have searched these forums and google and not really been able to determine the solution.

This is for a WPF application, but I think it is a more general programming question.

We have an ObservableCollection(of T), where we need do do some validation of the member object, T. One of the rules is that a property of T (say name) cannot already exist in the collection.

Our validation class is instantiated from the xaml, so I don't know of any way to pass in the reference to the ObservableCollection. However, this is needed to be able to step through the collection, to see if name has already been used, and report an error (if needed).

One solution I can see is that the class T could have a property which is an ObservableCollection of T, and then you pass the parent collection into the member object. I think this will solve the issues, but something says to me this would be bad practise... Can anyone clarify whether this will cause errors or should be avoided? Can anyone suggest an alternative?

More specifically, say we define Person
Public Class Person
    Public Sub New(ByVal Name As String, ByVal People As ObservableCollection(Of Person))
        ...
    End Sub

    Public Property Name() As String
        ...
    End Property

    Public Property People() As ObservableCollection(Of Person)
        ...
    End Property
End Class


Then elsewhere make a collection of Person
Dim MemberList As New ObservableCollection(Of Person)
MemberList.Add(New Person("John", MemberList))
MemberList.Add(New Person("Fred", MemberList))
MemberList.Add(New Person("Jane", MemberList))
MemberList.Add(New Person("Andrew", MemberList))


Then we can bind say a WPF DataGrid to MemberList, and use validation to check our rule, to check that the Person name has not already been used in the ObservableCollection(of Person) - ie MemberList. The approach here will work, but I am concerned that there might be underlying problems - some circular reference or something (or else just not good practise).

Thanks for any suggestions.

Tim
AnswerRe: Reference to parent collection Pin
Pete O'Hanlon26-Oct-09 22:44
mvePete O'Hanlon26-Oct-09 22:44 
GeneralRe: Reference to parent collection Pin
ausadmin27-Oct-09 9:54
ausadmin27-Oct-09 9:54 
GeneralRe: Reference to parent collection Pin
Pete O'Hanlon27-Oct-09 10:12
mvePete O'Hanlon27-Oct-09 10:12 
GeneralRe: Reference to parent collection Pin
ausadmin27-Oct-09 19:16
ausadmin27-Oct-09 19:16 
GeneralRe: Reference to parent collection Pin
ausadmin29-Oct-09 1:33
ausadmin29-Oct-09 1:33 
QuestionUserControl - visualbrush not rendered Pin
DeepakMega26-Oct-09 3:04
DeepakMega26-Oct-09 3:04 
AnswerRe: UserControl - visualbrush not rendered Pin
DeepakMega26-Oct-09 4:16
DeepakMega26-Oct-09 4:16 
Question3D Graphics C# and WPF Browser Application Pin
427748025-Oct-09 9:04
427748025-Oct-09 9:04 
GeneralRe: 3D Graphics C# and WPF Browser Application Book recommendation Pin
Richard MacCutchan25-Oct-09 13:31
mveRichard MacCutchan25-Oct-09 13:31 
AnswerRe: 3D Graphics C# and WPF Browser Application Pin
Death8U29-Oct-09 7:31
Death8U29-Oct-09 7:31 
QuestionMVVM Pattern Pin
NETLearning24-Oct-09 18:21
NETLearning24-Oct-09 18:21 
AnswerRe: MVVM Pattern Pin
Richard MacCutchan24-Oct-09 23:07
mveRichard MacCutchan24-Oct-09 23:07 
AnswerRe: MVVM Pattern Pin
Steve Westbrook26-Oct-09 7:00
Steve Westbrook26-Oct-09 7:00 
QuestionWPF MVVM Pin
NETLearning24-Oct-09 15:02
NETLearning24-Oct-09 15:02 
AnswerRe: WPF MVVM Pin
Richard MacCutchan24-Oct-09 23:08
mveRichard MacCutchan24-Oct-09 23:08 
QuestionMVVM newbie question - showing OpenFileDialog? Pin
Judah Gabriel Himango24-Oct-09 14:33
sponsorJudah Gabriel Himango24-Oct-09 14:33 
AnswerRe: MVVM newbie question - showing OpenFileDialog? Pin
Pete O'Hanlon25-Oct-09 9:36
mvePete O'Hanlon25-Oct-09 9:36 

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.