WPF: Extending the list view (problem using extended object)

G

Griff

I have a window with multiple ListViews in them.

When someone right-clicks on any of the listview items, then I want a
context menu to appear and one of the options is to copy the data displayed
to the clipboard.

For a single listView this is simple - I just use the right-mouse-click
event. However, as said, I've loads of these listViews and more will be
added in future, so I don't want to keep creating event handlers for every
instance.

So, I decided to go down the inheritance route.

I created a Class called "ListViewExtClass" which inherits from the
ListView. I changed the on-right-mouse-click event so that it has the
necessary code. Now to use it.

In the XAML <Window/> element, I tried to add the xmlns:local definition.
When I type in "xmlns:local=" it then gives me a list of options....one of
which is my project. I select it, so I now end up with
'xmlns:local="clr-namespace:MyProjectName" '. The only problem is that this
now displays with a squiggle under it. This expands to say "Assembly
'MyProjectName' was not found. Verify that you are not missing an assembly
reference. Also, verify that your project and all reference assemblies have
been built".

There are no DLLs etc, so everything is "within" the EXE.

I clicked on "MyProject" and went to the References tab. In the lower
listview, I found "MyApplicationName" in the list, but it was unticked. I
ticked it, but this has not solved the problem. I reversed this change.

It's something trivial I'm sure, but don't know what it is. All help most
appreciated.

Thanks

Griff
 
K

Karsten Schlender

I know this problem in VS 2005, but there it is a mere designer issue,
compilation should be possible.
Does this apply to you?

Karsten
 
G

Griff

Hi Karsten

Unfortunately not...

If I create a <ListView Name="abc"/> then this can be found in the code:
me.abc

However, if I create <local:ListViewExtended Name="abc"/> then "me.abc"
errors saying that "abc" is unknown.

Griff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top