15,897,315 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by PJ du Preez (Top 39 by date)
PJ du Preez
11-Jul-12 6:09am
View
Not between two Data Contract but between two Service Contracts... on the host side. I'm currently testing a Singleton class I made that derives from List<t>, but I think I might have concurrency issues :/
PJ du Preez
29-Mar-12 5:25am
View
Thanks, I'll have a look
PJ du Preez
29-Nov-11 8:22am
View
I've added it to my question
PJ du Preez
29-Nov-11 8:21am
View
Deleted
I've added it to my question. thanks
PJ du Preez
29-Nov-11 3:52am
View
Thanks. I tried what you suggested and I received the following error:
System.Windows.Data Error: 2 : Cannot find governing FrameworkElement or FrameworkContentElement for target element.
Is it not seeing my DataContext?
PJ du Preez
29-Nov-11 1:15am
View
Mmm. I get the same error as the previous time I tried:
System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.DataGrid', AncestorLevel='1''.
Have I chosen the correct Path? I've some more detail to my question (some info on the underlying model)
PJ du Preez
29-Nov-11 0:48am
View
Hi. thanks for the suggestion. I have tried this before (it seems like the logic thing to do), but it did not work. I'll try it again and see. Maybe I missed something.
The thing is the datagrid starts off empty and then when data is added, it should look back to itself, but I'll give your code a try and let you know.
thanks
PJ du Preez
11-Nov-11 5:32am
View
Cool, thanks.... I got that working.... but then realized, i dont actually need to go this route. but thanks a mil.. 5 stars!
PJ du Preez
11-Nov-11 5:07am
View
please could you show me how I would go about to do this?
would it be something like: MyCollection.CollectionChanged += OnCollectionChangedMethod
?
PJ du Preez
7-Nov-11 16:14pm
View
Have you managed to solve your problem?
PJ du Preez
7-Nov-11 15:57pm
View
" As I realized, you bound theItemsSource property of your control to an empty collection and, filled your collection afterwards."
Nope, i'm starting off with an empty entityset bound to the datagrid and want to full data in via the grid. I've tried using observable collection, but gave up halfway. I thought that I could use the same principles with a binding a datagrid to an entityset property as when binding a textbox to a string property.
Is observablecollection like a wrapper?
PJ du Preez
7-Nov-11 14:43pm
View
fixed
PJ du Preez
7-Nov-11 14:34pm
View
Oops, thanx for the break; Force of habbit. Default is good to have
PJ du Preez
7-Nov-11 14:30pm
View
combobox.selecteditem
PJ du Preez
7-Nov-11 14:29pm
View
You can load the options you want available into the combobox list using combobox.items.add() and then switch on the combobox.selecteditem. it is easier and you do not have to worry about the default
PJ du Preez
7-Nov-11 14:20pm
View
agreed, but the question was not about design, so I gave an answer in the context of the question
PJ du Preez
7-Nov-11 14:01pm
View
if you are using Visual Studio, just type "switch" and press the tab button twice. the IDE will generate a switch structure for you, just add the rest.
PJ du Preez
7-Nov-11 13:59pm
View
get rid of the TextChanged event
PJ du Preez
7-Nov-11 13:35pm
View
what should happen when you click on a button?
PJ du Preez
17-Oct-11 6:39am
View
What I managed to do (and I'm working out the kinks at the moment) is to use a combination of the factory method with the strategy pattern. I reckon I'll write a little article on it if it works out.
PJ du Preez
17-Oct-11 3:58am
View
Nah, scrap this. there is no difference in the above code and just simple Truck myTruck = new Truck();
PJ du Preez
17-Oct-11 2:59am
View
Sorry dude, I have to reject your solution. I just figure it out and I don't need to use any 'as' or 'is' operators. I'll give an explanation in my solution.
PJ du Preez
17-Oct-11 2:01am
View
You mean like a strategy pattern?
PJ du Preez
14-Oct-11 9:57am
View
because doing it like that is wrong. I do not want to be limited by concrete classes
PJ du Preez
14-Oct-11 9:23am
View
That's probably the easiest 5 stars you got ever. I did not know you can do that! Thanks!
PJ du Preez
11-Oct-11 13:35pm
View
Thanks. This was the other option I was considering. To use your example, i have a factory that (and this was my intention) to build an Employee-Address relationship for me (depending on the type of employee , a different address type should be attached). But i think to KISS i'll have to do away with the factory so that I can InsertOnSubmit my employee before i attempt to attach the address. I'm using a repository pattern to keep things seperate. Thanks again!
PJ du Preez
11-Oct-11 9:39am
View
Thanks, this is an option I was thinking of but due to complexities in my structure, this is not the route I want to go. I have done similar things with one to many relationships which works perfectly. any thoughts?
PJ du Preez
7-Oct-11 4:18am
View
That's pretty cool, we're using LINQ as an ORM\DAL. The generated code sucks eggs so it's all manually typed.
PJ du Preez
7-Oct-11 4:00am
View
Yes, my initial model did use List<t>. but with LINQ2SQL you use the entityset\ref as to accommodate the associations mapped by LINQ
PJ du Preez
6-Oct-11 13:16pm
View
Thanks for the link. it seems worth a read. My project does consist of a DAL. I'm using a DataContext implementation together with mapping generated by sqlmetal (i like the idea of POCO). between this and my BLL I have a repository to keep the two areas apart to prevent circular dependencies.
PJ du Preez
6-Oct-11 13:09pm
View
well I have spent quite a decent amount of time determining what will be needed and how to break the database into simpler 'smaller' structures for the individual modules. by this I mean it is in one model, but you can easily identify which table clusters belong to which module (they are all related in some way anyways) could it possibly be simpler?
PJ du Preez
6-Oct-11 13:03pm
View
thanks for the reply. my 'solution' does contain various 'projects' and I like the design. there are projects that depend on others (based on their tables' relationships in the database) the design without LINQ2SQL works perfect as the other projects do not know about the one that depends on it, but when implementing L2S the 'independent' modules then needs Entity Refs and Set of classes from the 'dependent' module thus creating a circular dependency. any ideas?
PJ du Preez
12-Jul-11 10:08am
View
hehehe, i like your answer. I also think that is what's happening here. The code generated from ArgoUML's diagram is spot on, except for the ArrayList (replaced with List<Component> in my final design) being generated by the aggregation, but the same design in VS2010 gives me different code.
thanks.
PJ du Preez
12-Jul-11 9:30am
View
So ACTUALLY what I'm asking is, can you use a generic list as a property and how?
PJ du Preez
12-Jul-11 9:05am
View
Thanks,
I see what you mean but I never meant for Component to be instantiated. I derive Composite from Component so that I can use public void addChild(Component childComponent) to add a Composite as a child (and eventually a Leaf).
I was curios about why the Class Diagram generates code that is not a collection (because a Composite can have many children of type Component ie Component composite = new Composite())
I ArgoUML for example, the generated code will give you an ArrayList. Is the code generated by VS2010 a better way to aggregate the two classes?
EDIT (after comment) =======================
Composite IS derived from Component... it is the Composite Design Pattern. using Component as the type that is passed to addChild allows for a recursive structure so that you can add more Component children to your Composite, which could be Leaf\Composite objects.
http://en.wikipedia.org/wiki/Composite_pattern so that we are on the same page.
what happens in VS2010 is that the aggregation between Component and Composite is removed when using anything other than the generated property (which can only hold 1 (one) object instead of a collection of objects). But when you draw an aggregation from the Composite to Component, the above mentioned code is generated. Is there a way of using a List<t> together with a properties getters\setters to add a value to the List<t> and retrieve a specific value from the List<t>?
PJ du Preez
12-Jul-11 8:50am
View
Thanks Tarun... couldn't get why it didnt do this for me...
PJ du Preez
25-Mar-11 2:18am
View
Ah, I see where I went wrong with this... In C++ I created a List<t> class from scratch, and added the overloaded + operator to THAT class. .Net already have a List<t> Class and thus I need to create a new inherited class to override the operator.
Thanks!
And the clouds parted, the sun shined through. Now I understand.
PJ du Preez
25-Mar-11 1:59am
View
"First, your code doesn't add all of the elements in one list to another list. It merely returns ONE of the specified lists."
I know, it was to keep the code simple for the question. What is being returned is negligible.
"Second, why don't you use the List.AddRange method instead (if you really want to combine the lists)?"
This is not what I want to do, if it was, I'd use List.AddRange. I want to at List1[i] to List2[i], hence the need to overload the operator (unless there is a simpler way to add corrosponding elements together)
Using an extention method is not as intuitive as simply saying List3 = List1 + List2, if you see what I mean.
Thanks for your view, though!
PJ du Preez
25-Mar-11 1:52am
View
@CPallini
Hi, thanks. Yes this is what I was wanting to do. I did operator overloading in C++, very similar in C#, couldn't understand where I was going wrong.
Thanks!
Show More