tags:

views:

123

answers:

2

Hi guys,

I am attempting to display a list of items (the style and controltemplate for these items are defined elsewhere) and i want to be able to add/remove as many as i want to. As i do not have infinite screen realestate I am displaying these in a ListBox control.

This is the screen i have to date:

alt text

What is going to happen is this. When i click the New button, i want the item to appear in the outlined area.

So now for the problem:

I want, when i click the New... Button, a new item to appear in the ListBox (outlined). Is it possible to do this using XAML? I am trying to work on seperating the business logic from the interface, so if there were some way to acheive this in XAML i would appreciate it. If not,can i use the custom templated item i have created in C# so that it will appear as the template specifies in the list box instead of like a normal ListBoxItem

Thanks in advance!

+4  A: 

I think the only way to achieve this is to add the new (empty) item to the list to which the outlined listview is databound.

If there's any business logic involved in creating the new item you should ask your business logic layer to create the new item for you, otherwise instantiate the object as you would normally do.

Gerrie Schenck
Thanks, i ended up pushing the data items from my business logic to the front end as you suggested :)
TerrorAustralis
A: 

you can use ObesrvableCollection for this purpose. Use twoway binding to show the details should be displayed in the list while typing.

Kishore Kumar
Thank you for your comment, i was under the impression that ObservableCollection must be the root element, which in this case can not be... am i wrong in this assumption?
TerrorAustralis