What to look for when double clicking on an item in a list view doesn't open the item in edit mode

Jun 28, 2013 at 1:00 AM
Edited Jun 28, 2013 at 1:01 AM
Markus,

Per the subject, the Add button works just fine. But I can't figure out where to put a breakpoint to find out why nothing seems to happen at all when I double click on the list box with the items in it... I know it's something stupid in my code, just not sure where or how to step through it.

I have checked and the Controls:ListBoxEx.Command="" seems to have a valid value (I even copy/pasted the method to be sure...)

Thanks,

Fletcher
Coordinator
Jun 28, 2013 at 12:10 PM
Another one of the key pain points with XAML :-). Declarative stuff is nifty, but when something goes wrong, being able to put a breakpoint somewhere would sure be nice. But in declarative stuff, you just can't. That has long been one of my biggest criticisms and concerns with declarative programming. Maybe I am too much of a control freak when it comes to programming :-).

Anyway: The first thing I would try is put a break point into your execute code, so you know whether it gets triggered at all. I assume you probably already tried this. If it doesn't trigger, there could be two problems: 1) the element isn't bound right to the command (have an eye on the Visual Studio Output Window where such a problem would be listed) or 2) triggering the event/command doesn't work right.

Question: Does it always happen when you double-click or only on certain items? For instance, does it behave different when you double-click on the selected item vs. a non-selected item?

Another thing that could be wrong is the command trigger. For listboxes, we allow triggering commands on single-click, double-click, or both. If that is set wrong, it could cause a problem. (Maybe you can also try switching to different themes to see if it behaves any different there).


Markus
Jun 29, 2013 at 1:27 AM
Markus,

Ok, I found the issue and all is good (ok, at least for this issue... :) )

Anyway, I think one of the issues is that many things often have the same name (Model/Customer/List.cs, View/Customer/List.xaml, etc. ) and a reference to simply "List" can be confusing in some cases as people try to figure out where to find "List".

It might be good to have a sample app that people can download that provides a working model for people to use to get started - complete with a local db.

Maybe have one MVC implementation (say customers) that uses names that make each part clearly identifiable (CustomerListModel.cs, CustomerListView.xaml, CustomerEditMethod(), etc.) and a second (say employees) that uses the simpler naming schema so people can see the benefit of using that approach.

Heck, if you build a basic sample app, you might even encourage some of us ("us" being anyone but you) to add additional examples that demonstrate other parts of the FW. So someone might create a sample form that has a 1-many-many type relationship with some fields being foreign keys into code lookup tables, etc. You get the idea. But it would be nice if the basic sample app was prepared in a very clean way so there are at least 2 good examples for newbies to start with.

Another advantage with this is if you work on a new approach, you could use the sample app as a way to not only test, but for us to see how to implement the new features.

Just a thought (not that I figure you have the spare time to do this, but maybe it can be created as part of one of the CODE FW how to classes.

Take care,

Fletcher
Coordinator
Jul 1, 2013 at 8:49 PM
We do actually have smaller sample apps that go with the downloads of the various articles we have publishes. I guess it would be nice to have a single larger sample app is what you are saying? I think that could make sense.

For the naming: Really, the controller method name ties things together unless you go out of your way to specify other names. So the name of the view is typically the same as the name of the controller method. (The view model is just a class you instantiate, so you can really call that anything you want). We tried to stick with the same naming convention as ASP.NET MVC there.


Markus
Jul 2, 2013 at 4:33 AM
Markus,

I was thinking of a standard demo app that could be downloaded from the Codeplex site, where the controller/model/view demonstrated some key approaches on how to do things.

So one might have everything spelled out, while another be much more concise. And since they would work essentially the same, it provides a good compare and contrast.

Just a thought.

Fletcher
Coordinator
Jul 2, 2013 at 1:25 PM
I think for the smaller ones, we are already in good shape with the examples that come with the articles. But a larger, more comprehensive app would be nice.

So many ideas, so little time :-)


Markus