Click here to Skip to main content
13,740,333 members

Comments by SteveAdey (Top 71 by date)

SteveAdey 20-Jun-12 16:43pm View
   
I'd read some more books on WPF.
SteveAdey 20-Jun-12 16:40pm View
   
I sincerely hope you don't have INotifyProperty on your model. The model should be light weight and free from knowing anything about business logic or property changes. Validation should be done with a separate class or service that is used by the view model. That service will use the model in its validation, but at no stage should the validation logic be inside the model. This will hamper reuse.
SteveAdey 3-Apr-12 17:32pm View
   
Can you post some code, as this should work.
SteveAdey 27-Mar-12 1:24am View
   
Ok, the quickest way I can think of at the moment (and it is 6 o'clock in the morning here), is to add another dependency property to your control. Something like DoCalc which is a bool and listens for a property change in PropertyMetadata. Put the a property on your ViewModel called the same. Bind your control's DoCalc to your ViewModel's DoCalc. When the menu item function is run set DoCalc=true. This will trigger the property changed event in your control. Do your stuff, set the MyProperty and then reset DoCalc=false. This should now do what you need :-)
SteveAdey 26-Mar-12 18:31pm View
   
If you'd like to post some code, I can take a look.
SteveAdey 26-Mar-12 17:09pm View
   
Which control is it? Is it your own control, or a standard one? If it's a standard one, then you are best writing a Behavior for it and exposing some dependency properties on it. Then you can bind these to where you need them on your view model. The click will then update the property.

This should give you an idea of where to start with the Behavior:

http://tap-source.com/making-wpf-images-icommand-aware/

That's demonstrating a Behavior for a ComboBox
SteveAdey 26-Mar-12 16:59pm View
   
Ok, this is how I see it.. You have a dependency property on your control that is bound to your ViewModel. You have a Command on your ViewModel which is bound to your Menu Item. When you click the menu item, you want to use that value, do a calculation and then update your view model.

If this is correct, then you need to add another dependency property to your control, bind that to your ViewModel, but in the binding, set its Mode=OneWayToSource. Then when you update the dependency property in your control, it will push the value back to your ViewModel property that you have bound to.
SteveAdey 26-Mar-12 16:15pm View
   
Maybe I'm missing something, but why can't you just modify the property on your ViewModel directly, rather than get the control to do it?
SteveAdey 26-Mar-12 16:10pm View
   
Which property? Is it one on your ViewModel?
SteveAdey 5-Mar-12 15:09pm View
   
Sure there's a clean way, use an ObservableCollection of the items in your View Model and then bind them to the ItemsSource of the TabControl.
SteveAdey 29-Feb-12 14:54pm View
   
Wouldn't this be slightly easier:

private bool IsLastDayOfMonth(DateTime dt)
{
return !(dt.AddDays(1).Month == dt.Month);
}
SteveAdey 24-Feb-12 7:03am View
   
yes. But use whichever mechanism you are happy with.
SteveAdey 24-Feb-12 4:32am View
   
See my solution on how to dynamically create the object and use it in your code.
SteveAdey 23-Feb-12 8:47am View
   
That's only one you can answer, depending on your situation. If it were me, I would follow the .Net route, as this has a much wider range of companies to choose from that use it. It will also give you much more of a foot hold into 'real' programming.
SteveAdey 23-Feb-12 4:32am View
   
I would suggest something has gone wrong in the design process. Looks like you're talking more about UI automation here.
SteveAdey 23-Feb-12 4:31am View
   
I think if you read it again, he says this is a WinForms application, not an ASP.Net one as indicated in the tags.
SteveAdey 23-Feb-12 4:26am View
   
It's not a question of whether a PHP programmer can go to Java or .Net. It's more to do with how you as a developer approach the situation. However, as a PHP programmer, you will not be taken seriously as a Java or .Net developer.

You must learn and prove yourself in those areas first.
SteveAdey 21-Feb-12 7:13am View
   
Sorry, that wasn't a dig, more of a suggestion to help you in the future.
SteveAdey 21-Feb-12 3:10am View
   
I've now updated the solution to show you how to bind to the selected value.

Each row should have its own ViewModel. i.e. you want an overall ViewModel with an ObservableCollection of your row ViewModels.

If you take a look at http://tap-source.com/?p=160, that should give you some idea of how to do this. If you're going to do WPF, then you really need to learn MVVM.
SteveAdey 19-Feb-12 16:31pm View
   
Hi Timur, I've now updated my solution with an example. My main reason for not recommending the Value Converter in this case, is that it's something the view model should be dealing with. The Converters are really to convert data from one type into a more visual type. This will do what you want, but what if some data came from another source as was not delimited by the '|' character? Or you had a list that was not delimited at all? This would make for some very messy XAML. I'm not saying that you shouldn't use it here, just that it's not good practice.
SteveAdey 19-Feb-12 11:05am View
   
hmmm, not sure why you couldn't get this to work, given your solution, as they should equate to the same thing. Mine's just doing it in the ViewModel, while yours is doing it in a converter (IMHO not the way to go). But, if it works for you...
SteveAdey 18-Feb-12 11:45am View
   
The MainViewModel should be showing an example of that.
SteveAdey 18-Feb-12 11:10am View
   
I take it you mean that you would like to add new language strings without adding them to an xml file first???
SteveAdey 17-Feb-12 9:54am View
   
Cool, any problems, give me a shout ;)
SteveAdey 15-Feb-12 16:54pm View
   
Then without the power of the ether, I think you may be stuffed, there has to be some way of the machines knowing about each other, otherwise what you are asking is impossible.
SteveAdey 15-Feb-12 10:37am View
   
Start by re-reading the class assignment and then question whether this is what you really want to do.
SteveAdey 14-Feb-12 10:20am View
   
Yes, that looks good.
SteveAdey 14-Feb-12 9:58am View
   
Hang on, you've said:

"There I've added all the 3rd party assemblies as Content with Copy to output directory set to Always copy."

You shouldn't have to do that. And your references are definitely pointing to your third-party directory?
SteveAdey 14-Feb-12 9:39am View
   
Deleted
Ok, you've posted it under C#, but VB.Net should also have the listbox selection changed event, that should be triggered when you select new items and they should be in the event args of that event.
SteveAdey 14-Feb-12 9:35am View
   
I wrote my own using MVVM and the DataGrid :p
SteveAdey 14-Feb-12 9:21am View
   
BTW, if you're going to proceed with your current method (which I'm not saying you shouldn't), you should really rename it TryRename, that's the standard way of naming something like this.
SteveAdey 14-Feb-12 9:18am View
   
Think you're going to have to be more specific here. Please post some code.
SteveAdey 14-Feb-12 9:10am View
   
You will probably need exception handling in your application, otherwise you're just relying on the fact that you dlls are behaving nicely (not recommended). You asked for advice, this is mine :-)

You can add other properties to a specialised Exception that you create and then use the inner exception to house the one caught.
SteveAdey 14-Feb-12 9:00am View
   
If you're happy, then that's fine. I found it too restrictive on the styling and gets in the way of MVVM. I'm talking the pivot table now. As for the rest of the controls, it's easy enough to style them yourself.

There's some great free charting libraries on Codeplex, but each has their strengths and weaknesses, as I'm sure DevExpress does.
SteveAdey 14-Feb-12 8:34am View
   
oooh, apart from the DevExpress ;-)
SteveAdey 14-Feb-12 8:34am View
   
Good answer Espen - my 5
SteveAdey 14-Feb-12 5:49am View
   
If you're talking about a reference to it, then right click references in the solution explorer and then in the Add Reference dialog choose the .Net tab. Wait a few seconds and then click on the Component Name header to sort the assemblies. Hopefully you can find your Crystal Report assembly in there. Unfortunately, I don't know much about crystal reports.
SteveAdey 14-Feb-12 5:28am View
   
Ok, I understand now, but you don't want the trigger on the buttons, you'll need it on the element that is going to contain the buttons. Again I would use opacity because then you can add a storyboard to make a nice fade in/out animation.
SteveAdey 14-Feb-12 4:27am View
   
My point was, that it shouldn't be one windows service, I wasn't just rewording what you said. i.e. distributed counters.
SteveAdey 13-Feb-12 14:56pm View
   
You could be right, but it's not clear without the proper requirements of what he's trying to achieve. Without his input, which now seems to be missing, he may have solved this one by himself.
SteveAdey 13-Feb-12 10:48am View
   
Yeah, but your's would need lan and internet access. I'd also assume (could be wrongly) that since there are multiple PCs without internet access, that they would be networked.
SteveAdey 13-Feb-12 10:05am View
   
Try accessing the registry remotely from the other PCs.
I've given this a 4, as I think it's an interesting question.
SteveAdey 13-Feb-12 10:04am View
   
The registry could work for multiple computers as you can access registries remotely.
SteveAdey 13-Feb-12 10:02am View
   
Of course it would have to build it as a peer to peer system in case that 'one' computer was off, so they could all act as counter keepers. Makes it a little more complex though.
This would be by far the most robust solution.
SteveAdey 13-Feb-12 10:01am View
   
I'd recommend your one Michael ;-) It doesn't need internet access.
SteveAdey 13-Feb-12 6:32am View
   
Make sure you change the right version number, if memory serves it's not the obvious one (Upgrade one), but the main one.
SteveAdey 13-Feb-12 6:25am View
   
That wasn't initially stipulated. Garbage in, garbage out ;-)
SteveAdey 9-Feb-12 10:27am View
   
That's fine, but I don't understand why beginners are being given this kind of task. This is at best intermediate level.
SteveAdey 9-Feb-12 9:52am View
   
I gave you the XAML for this yesterday. You basically asked the same question. The text in the rectangle I showed can be set through binding. In order to do that you set up a view model with the text as a property.

Unfortunately, I've spent enough time on this, without any comment from yourself, so as Christian says, we're not going to do all the work for you. Ask a specific question.
SteveAdey 8-Feb-12 15:15pm View
   
Hi Jacques, did you get a chance to try this out in VB?
SteveAdey 8-Feb-12 10:13am View
   
Thanks for the 5 Sergey
SteveAdey 8-Feb-12 5:28am View
   
I have to disagree. Linq is highly optimized in the background (by those clever boffs at MS). Also, your solution is missing a second string, which would add more processing to your solution.
SteveAdey 8-Feb-12 5:10am View
   
How is my one line solution above a sledgehammer? compared to your multi-line solution?
SteveAdey 25-Jan-12 10:35am View
   
You can, but be careful about performance, especially if you're calling it a lot.
SteveAdey 24-Jan-12 11:37am View
   
Deleted
What's wrong with NetworkChange.NetworkAddressChanged?
SteveAdey 24-Jan-12 9:04am View
   
Thanks Ninja, was trying to keep it succinct.
SteveAdey 24-Jan-12 8:56am View
   
np, thanks for the 5
SteveAdey 24-Jan-12 8:51am View
   
Deleted
Sorry, yes, saw that and deleted the comments.
SteveAdey 24-Jan-12 8:47am View
   
Deleted
in fact, that's not my original code, whoever put the <pre> tags on removed it.
It did read var str = "Cobalt II</br>".Replace("</br>", "");

If you're going to put tags on, at least leave the code as it was.
SteveAdey 24-Jan-12 8:46am View
   
Deleted
Yes, sorry, forgot to assign the Replace result. And, yes, I do know strings are immutable.
SteveAdey 24-Jan-12 6:02am View
   
No problem, glad to help.
SteveAdey 24-Jan-12 4:22am View
   
It sounds like you've been given a school assignment and you want someone to do it for you. Take a different course ;-)
SteveAdey 23-Jan-12 14:33pm View
   
Yes, that will help you do that.
SteveAdey 23-Jan-12 11:41am View
   
Unfortunately, I can't see the problem. It seems to select fine.
SteveAdey 23-Jan-12 9:11am View
   
Deleted
Please don't tell me you use global variables???
SteveAdey 23-Jan-12 8:50am View
   
CPallini is right. You would only pass a ref in for structs normally. You don't want to change the reference to the object, merely the object's contents. So, follow the example CPallini gave and you should be ok.
SteveAdey 23-Jan-12 5:21am View
   
Why do you need your listbox in a scrollviewer?
SteveAdey 20-Jan-12 11:29am View
   
The difference is that the Values are just an IList<tvalue> which has no mechanism to notify of its changes.

What are you trying to achieve with cbxNotUpdating that you cannot with cbxUpdating?
SteveAdey 20-Jan-12 10:43am View
   
I have some code laying around somewhere that adds the columns in from code behind. I can dig it out at the weekend and post it up.
SteveAdey 20-Jan-12 9:26am View
   
Why do you need the C# equivalent?
SteveAdey 18-Jan-12 4:15am View
   
Try using XamlReader to get the xaml out and then create that in the new TabItem.

Advertise | Privacy | Cookies | Terms of Service
Web04-2016 | 2.8.180920.1 | Last Updated 1 Jan 1900
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid