|
I don't think it's convoluted at all. All of the classes are in the same folder with no namespace declared. How can there be any circular references when the namespace is the same for all of the classes (except the root one, of course)?
MyControl --->MyBase --->UserControl
How is that convoluted (or even circular)? BTW, the actual source files compile fine - it's the .g.vb files that are not.
I *did* try a "clean solution" (and stated as much in my OP), and it compiles just fine. But when I try the same thing in my project, it doesn't compile with errors in the .g.vb files. The same code (in the original C# app) compiled just fine.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
FWIW I have has a similar issue that I couldn't see what was causing the problem. Eventually I gave up. next time I restarted VS2010 it just compiled fine!. never did find out why.
I'm guessing you already restarted VS, but thought it worth mentioning.
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
I actually rebooted the system. These are the only errors remaining in the project, and it's really pissing me off.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Actually not specifically MVVM or even specifically WPF - but this is what I need help on...
I have a CustomerDetailsView and I have a CustomerDetailsViewModel
This view shows (obviously) a single customer's details.
I also want a list of customers that the user can search.
So - my initial thought was to have a collection of CustomerDetailsViewModels which I bind to something in a CustomerListView. so I have a CustomerListviewModel with a property of ObservableCollection<customerlistviewmodel>
but that strikes me as being wrong.
I really only want to show the customer first and surname in the list (let's say) - not the whole address, order values etc.
So my next thought was not to use a ViewModel collection at all, but just a collection of - What? customer models? Customer list models?
The ViewModel that 'displays' the list needs to be ignorant of the actual view - it just demands that there is a list of customers from which the user can select one, which will send a command back to the View model.
But because it doesn't know how this list is to be displayed, should it provide a collection of some ViewModel or other, each element injected into a view so I have a collection of views and associated view models that can then be shown in some sort of list?
Or do I provide a collection of data to which the grid (or whatever) binds?
I guess what the question boils down to is:
Is each element in a 'grid' displayed to the user a View with an associated ViewModel?
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
My eyes crossed about 3/4 through that trying to keep track of the collections.
caveat - I am fairly fresh into the MVVM scene!
I would not consider having a collection of views or viewmodels. I only deal with collections of models. My models are based on database views that include all the FK descriptors that are required by the VIEW. Note only descriptors not any sub collections.
So I would have a collection of customer models (it may be a filtered collection based on the environment). In my VM base I have a static method that takes a shallow copy of the collection or object, this disconnects the new collection from the important collection and allows me to add defaults etc into the list. This is then used to populate combo controls. All are observablecollections
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: My eyes crossed about 3/4 through that trying to keep track of the collections.
yeah - sorry! In my defence, it was written last thing on friday before I left work.
Now it is later Friday and I am pissed - so I won't try.
I'm just checking out a couple of MVVM sites
This one is quite nice[^]
and listening to a hHanselminute blog
here[^]
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
I use the galasoft framework such that it is. Very minimalist.
As for Friday night, mine is just starting, a nice bottle of white, maybe a tequila taler and some sort of liqueur after dinner.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
The general rule is that you only retrieve and handle what the view needs to display. So, for instance, if your view doesn't need the full address then you don't retrieve it. I always get nervous when I see ViewModels binding to ViewModels which in turn may bind to other ViewModels. This is missing the point of what the VM is actually for.
|
|
|
|
|
Yeah - I'm beginning to think that the VM is for two things:
1. To control a View's logic
2. To provide a view with data
I'm beginning to wonder whether I should have two classes
1. A ViewController
2. A ViewData
The ViewData object is the provide of data for that particular view.
The ViewController handles any commands required for that view
The ViewController would need to be the View's DataContext - so would need a property of ViewData - but that seems more senisble to me than having a ViewModel with a whole heap of properties as well as a whole heap of command logic.
whadya reckon?
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
I think this is one abstraction too many, especially as one of the things you might want to do with a VM is decide whether or not you want to be able to execute a command which may well depend on the value of some properties. Plus, where would your validation fit in all of this?
|
|
|
|
|
Essentially I'm just thinking that a VM, rather than having several properties which are bound to, has one ViewData property - which would 'contain' all of the properties that traditionally would be in the VM.
So if the ability of a command to execute depends on a member of the ViewData object - all well and good.
If the ability of a command to execute depends on some other criteria, then the VM would expose a property which the View could bind to for this purpose.
The former is a purely data-based rule, the latter some business logic rule - hence sensible separation, no?
it's like the application says
"Hey - I want to display this Customer data and let the user modify it, but the phone number can only be changed by an administrator"
The ViewModel goes and gets (or is given) a Customer Model.
The ViewModel creates a ViewData object exposing the model properties.
Additionally the ViewModel has a property IsAdministrator
The View uses IsAdministrator to determine whether the Phone Number is changeable - but this data isn't part of the ViewData
As for validation - frankly I haven't looked at validation in WPF/MVVM at all yet, so I'm not sure where the validation would go in the traditional model, let alone in this embryonic idea of a model!
If you have any good references for MVVM WPF validation I'd be interested in taking a look.
thanks for taking the time
max
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
|
Wrong place for this post mate.
You could post this as a tip trick or configure your blog to appear on CP.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
|
Hi, in our win forms program we get the bitmap of an activeX control (its the Microsoft mappoint control) using the PrintWindow() function in User32.dll, this works fine.
Now we are moving our program over to wpf. The technique still works as it did until the activeX control is not visible, any part of the control that is not showing on the screen justs comes out as black.
It is as if in wpf the control is not drawn unless it is on screen.
Is there a way we can force it to draw the bitmap of the control?
thanks.
|
|
|
|
|
Hi,
How to roll(automatically moving from bottom to top) data in datagrid in silverlight?
please help me..
|
|
|
|
|
So what ideas have you got, what have you tried and what didn't work?
Do you want the control in xaml?
Are you using a viewmodel?
I can think of a number of ways to do it via a viewmodel.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
ya. i want the control in xaml.
i am not using any viewmodel.
|
|
|
|
|
Try DataGrid.ScrollIntoView(item, column);
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
Visit the Hindi forum here.
|
|
|
|
|
It is for up to particular column or row. i don't want to particular column or row. i want to continuously move whole data in data grid from bottom to top like marquee in html. i.e if data is coming to end then it again move from beginning.
|
|
|
|
|
Hi,
I know it's not completely related to this section, but I'm developing a silverlight application that is going to get user advertises in image and video format.
I'm ambigious about saving the content in db as binary or saving the files and in server hard and just putting the pathes in DB.
It shoud has a lot of advertises.
Which approach I shoud select?
Best wishes
|
|
|
|
|
I'm just finalising my application, lots of photos and forms to be up/down loaded and I'm still ambiguous. I opted for the file path but just ran across an issues where they may want files with the same name, debated moving to the database but decided to prefix the file with the ID from the database instead.
I struggled getting the DB operations to be consistently reliable.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Mycroft Holmes wrote: I'm just finalising my application, lots of photos and forms to be up/down loaded and I'm still ambiguous. I opted for the file path but just ran across an issues where they may want files with the same name, debated moving to the database but decided to prefix the file with the ID from the database instead.
The normal method for doing this is to give each file a unique name (say generated as a GUID), and store the unique name against the original name in the database.
|
|
|
|
|
I hadn't thought of the guid, I hadn't thought much about it at all which is not good. Prefixing with the record id will at least leave me with a readable file name.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Don't worry about it - you've created a perfectly valid way of making the file name unique. The Guid approach is just one such approach.
|
|
|
|