Click here to Skip to main content
15,922,015 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Parsing binary TCP messages Pin
earlgraham30-Oct-09 9:33
earlgraham30-Oct-09 9:33 
GeneralRe: Parsing binary TCP messages Pin
Mark Salsbery30-Oct-09 9:54
Mark Salsbery30-Oct-09 9:54 
Questionhow to export wpf datagrid to excel? PinPopular
Viji Raj28-Oct-09 11:44
Viji Raj28-Oct-09 11:44 
AnswerRe: how to export wpf datagrid to excel? Pin
Christian Graus28-Oct-09 13:33
protectorChristian Graus28-Oct-09 13:33 
QuestionListView Column formatting Pin
hb5213421428-Oct-09 9:07
hb5213421428-Oct-09 9:07 
AnswerRe: ListView Column formatting Pin
Death8U29-Oct-09 4:34
Death8U29-Oct-09 4:34 
GeneralRe: ListView Column formatting Pin
hb5213421429-Oct-09 6:34
hb5213421429-Oct-09 6:34 
GeneralRe: ListView Column formatting Pin
Death8U29-Oct-09 7:20
Death8U29-Oct-09 7:20 
GeneralRe: ListView Column formatting Pin
hb5213421429-Oct-09 8:47
hb5213421429-Oct-09 8:47 
GeneralRe: ListView Column formatting Pin
Death8U29-Oct-09 9:19
Death8U29-Oct-09 9:19 
GeneralRe: ListView Column formatting Pin
hb5213421429-Oct-09 9:46
hb5213421429-Oct-09 9:46 
QuestionScaling Polyline w/o scaling thickness Pin
Niklas L28-Oct-09 3:58
Niklas L28-Oct-09 3:58 
QuestionRe: Scaling Polyline w/o scaling thickness Pin
Mark Salsbery29-Oct-09 7:16
Mark Salsbery29-Oct-09 7:16 
AnswerRe: Scaling Polyline w/o scaling thickness Pin
Niklas L29-Oct-09 11:41
Niklas L29-Oct-09 11:41 
GeneralRe: Scaling Polyline w/o scaling thickness Pin
Mark Salsbery29-Oct-09 12:03
Mark Salsbery29-Oct-09 12:03 
GeneralRe: Scaling Polyline w/o scaling thickness Pin
Niklas L29-Oct-09 12:22
Niklas L29-Oct-09 12:22 
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 

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.