views:

29

answers:

0

Hi,

I am developing a WPF appliction in .net 4.0 which has got one user control. For simplicity, this user control has got only one combox which gets its value from view model's observable collection. This observable colletion is populated via a call to EF entity which gets its data from a view. The combobox's itemssource property is bound to the observable collection with necessary values in SelectedValuePath and DisplayMembePath.

Now when I run this application, the combox does populates the list but instead of showing individual item from the view it just repeats the first item returned by view for total number of rows in the view. For eg.g

Combobox should show following

Data1

Data2

Data3

Instead it is showing

Data1

Data1

Data1

I tried everything but still not able to find the solution. Is it somekind of bug in WPF comboxo or I am doing something wrong.

PS: The view internally uses Union in order to join multiple values. The Query for the view is as follows


SELECT DISTINCT CASE WHEN Field = '' THEN Brief ELSE Field END AS Field, 'Field' AS SourceName
FROM         dbo.FieldsData
WHERE     (Brief  '') AND (Field NOT IN ('Model', 'Research Note', 'Attachment'))
UNION
SELECT     'Company', 'Companies'
UNION
SELECT     'DateTime', 'Field'
UNION
SELECT     'Year', 'Field'
UNION
SELECT     'Comment', 'Field'