|
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.
|
|
|
|
|
Using a GUID for a filename also makes it impossible to identify a file if yuo have to manually wade throuh a directory to find something.
5CAABC01-8A13-4708-AB1F-35A5349C99EC.jpg
05062E0E-9DAD-4aa0-832B-40DB1B8F0F73.jpg
Of those two file names, which one is picture of your dog, and which is the picture of some sweet young thing at the beach that your wife doesn't know you snapped a picture of?
.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
|
|
|
|
|
That's what the database is for.
|
|
|
|
|
Pete O'Hanlon wrote: That's what the database is for.
You are starting to sound like SAP/SAS
Thats what the data dictionary is for.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Pete may have a point here, my wife has absolutely no idea how a database works.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I was talking about the files being on disk. If they're actually in the database, you should be safe.
.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
|
|
|
|
|
Never mind. Got it
Everything makes sense in someone's mind
|
|
|
|
|
Thats got to be the fastest response I have ever seen. Normally there is a few minutes delay while you think about it.
OR did you edit the original question!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Kevin Marois wrote: Never mind. Got it
Ok.
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!
I have added a hyperlink in silverlight.
But when i click on the link it displays a blue rectangular border for the size of the hyperlink control.
The link opens a popup window, so this doesn't look so good on the webpage.
<HyperlinkButton x:Name="History"
Content="History"
Margin="0"
FontFamily="Arial"
FontSize="10.667"
Click="HistoryHyperlinkButton_Click"
Foreground="Black"
FontWeight="Bold" Background="{x:Null}" Cursor="Hand"
BorderThickness="0"
/>
Is there a way to disable this or have i missed somethink?
|
|
|
|
|
One way is to set the IsTabStop="False" on the button.
The other way, more correct but tedious, is to style the hyperlink button to modify the focussed state of the state manager.
For this you will need to either use Expression Blend or pick up the style from msdn and then modify and use it.
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.
|
|
|
|