Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get data from listview/gridview and populate another listview/gridview?
    primarykey
    data
    text
    <p>Using the XAML listview/gridview with binding I populate grid using linq query and C# code:</p> <pre><code> AdventureWorkEntities awDatabase = new AdventureWorkEntities(); var products = from p in awDatabase.Products from i in awDatabase.ProductInventories where p.ProductID == i.ProductID &amp;&amp; p.ListPrice &gt; 0 &amp;&amp; p.Name.Contains(search.Text.Trim()) select new { p.ListPrice, p.Name, p.ProductNumber, p.DaysToManufacture, i.Quantity }; IListSource query = (IListSource)products; ProductsList.ItemsSource = query.GetList(); </code></pre> <p>I noticed a double click event for selected items. What is the syntax to be able to double click a row and transfer that row into another grid below it? </p> <p>The jist is that I'd like to be able to add one row from one grid to the other grid by double clicking the selected item from one grid.</p> <p>Edit: XAML Code:</p> <pre><code> &lt;ListView Name="ProductsList" IsSynchronizedWithCurrentItem="True" DataContext="{Binding}" Margin="6,76,6,220" Width="726" MouseDoubleClick="ProductsList_MouseDoubleClick"&gt; &lt;ListView.View&gt; &lt;GridView&gt; &lt;GridView.Columns&gt; &lt;GridViewColumn Width="85" Header="Product Number" DisplayMemberBinding="{Binding Path=ProductNumber}"/&gt; &lt;GridViewColumn Width="225" Header="Name" DisplayMemberBinding="{Binding Path=Name}"/&gt; &lt;GridViewColumn Width="135" Header="Days To Manufacture" DisplayMemberBinding="{Binding Path=DaysToManufacture}"/&gt; &lt;GridViewColumn Width="75" Header="Quantity" DisplayMemberBinding="{Binding Path=Quantity}"/&gt; &lt;GridViewColumn Width="75" Header="List Price" DisplayMemberBinding="{Binding Path=ListPrice}"/&gt; &lt;/GridView.Columns&gt; &lt;/GridView&gt; &lt;/ListView.View&gt; &lt;/ListView&gt; </code></pre> <p>And my Attempt:</p> <pre><code> private void ProductsList_MouseDoubleClick(object sender, MouseButtonEventArgs e) { //code to place the contents of top grid to bottome grid List&lt;IQueryable&gt; selectedContents = new List&lt;IQueryable&gt;(); selectedContents.Add((IQueryable)ProductsList.SelectedValue); IListSource query = (IListSource)selectedContents; OrderContents.ItemsSource= query.GetList(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload