Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't get text from textbox inside a listview
    primarykey
    data
    text
    <p>XAML code:</p> <pre><code>&lt;ListView.View&gt; &lt;GridView x:Name="myGridView"&gt; &lt;GridViewColumn Width="0" DisplayMemberBinding="{Binding Id}"&gt; &lt;GridViewColumnHeader Content="Id" IsHitTestVisible="False" /&gt; &lt;/GridViewColumn&gt; &lt;GridViewColumn Width="50" Header="Cant"&gt; &lt;GridViewColumn.CellTemplate&gt; &lt;DataTemplate&gt; &lt;TextBox FontSize="11" /&gt; &lt;/DataTemplate&gt; &lt;/GridViewColumn.CellTemplate&gt; &lt;/GridViewColumn&gt; &lt;GridViewColumn Width="300" Header="Nombre" DisplayMemberBinding="{Binding Nombre}" /&gt; &lt;/GridView&gt; &lt;/ListView.View&gt; </code></pre> <p>C# code to fill myListView with items from another listview:</p> <pre><code>private void myListView_Drop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent("myFormat")) { foreach (var item in e.Data.GetData("myFormat") as Dictionary&lt;string, string&gt;) { var itemC = new {Id = item.Key, Cant = "", Nombre = item.Value}; myListView.Items.Add(itemC); myListView.SelectedItem = itemC; } } } </code></pre> <p>C# code to retrieve items from myListView:</p> <pre><code>private Dictionary&lt;string, string&gt; GenerateArts() { var arts = new Dictionary&lt;string, string&gt;(); dynamic result = myListView.Items; foreach (var item in result) arts.Add((string) item.Id, (string) item.Cant); return arts; } </code></pre> <p>After myListView is filled users can write numbers in each textbox of the column 'Cant' but later, when a button is clicked and GenerateArts() is invoked, those numbers are lost, i.e., item.Cant is "" (empty string) for each item.</p> <p>What's the problem?</p> <p>Edit:</p> <p>When GenerateArts() is invoked the values for item.Id and item.Nombre are there as expected. The problem is with item.Cant.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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