Quantcast
Channel: Silverlight Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 801

Commented Issue: LongListSelector passes the wrong DataContext to MenuItem (Patch provided) [7888]

$
0
0
<p>I created a context menu inside the item template for LLS. One of the menu item in the context menu performs a deletion to the underlying data source that was bound to LLS thru a view model class as middle layer. The operation is performed thru menu item click event handler. Inside that handler, I cast the sender parameter to MenuItem, and obtain the target object thru its DataContext property.</p>
<p>&#160;</p>
<p>Now suppose I have the following items presented in LLS:</p>
<p>&#160;</p>
<p>abc</p>
<p>def</p>
<p>ghi</p>
<p>&#160;</p>
<p>If I delete def thru context menu, that's fine, and it's gone. The LLS would display:</p>
<p>&#160;</p>
<p>abc</p>
<p>ghi</p>
<p>&#160;</p>
<p>Now if I delete ghi thru context menu, it's still there. I debugged into the handler and noticed that the DataContext of menu item of ghi reported def, the previous deleted one! That's why Remove of the underlying data source ignores my operation. Worse still, the ghi will never be able to delete, coz it's tied to a wrong DataContext? But why can it show the correct content??</p>
<p>&#160;</p>
<p>I tried the same with ListBox. It just works fine! I think that's a LLS issue rather than a ContextMenu issue. Any idea?</p>
Comments: ** Comment from web user: crahul **

This patch is needed by so many people, please add it into the next release.

http://www.codeplex.com/Download?ProjectName=silverlight&DownloadId=184550


Viewing all articles
Browse latest Browse all 801

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>