1
I’m using a bank in sqlite
, already done and with data in my application UWP
and trying to display in a listview
the data in the table Marcas
.
What I’ve done so far is create a class Marcas
:
public class Marcas
{
public string Nome { get; set; }
public string Imagem { get; set; }
public string Descricao { get; set; }
}
I created a listview
onscreen
<ListView x:Name="listView" HorizontalAlignment="Left"
Height="800" VerticalAlignment="Top" Width="500">
<ListView.Header>
<StackPanel Height="100" Width="100">
<TextBlock Text="{Binding Nome}"/>
<TextBlock Text="{Binding Imagem}"/>
<TextBlock Text="{Binding Descricao}"/>
</StackPanel>
</ListView.Header>
</ListView>
The estate:
public ObservableCollection<Marcas> obs_Marcas { get; set; }
and the method to get the bank records:
List<Marcas> oMarcas = conn.Query<Marcas>("Select * From Marcas");
obs_Marcas = new ObservableCollection<Marcas>();
foreach (Marcas marca in oMarcas)
{
obs_Marcas.Add(new Marcas { Nome = marca.Nome,
Descricao = marca.Descricao,
Imagem = marca.Imagem
}
);
}
listView.ItemsSource = obs_Marcas;
Debugging, the object obs_Marcas
is filled in correctly with the database data. At the time of the obs_Marcas.Add
, name, description and image are being filled in correctly, but in the application the list gets all the records as GeraBanner.Marcas
.
What I did wrong and how to display the data correctly?
https://social.msdn.microsoft.com/Forums/en-US/b6099324-e66c-42ef-9bfe-a0f022e2b6ab/twoway-binding-working-on-strings-but-not-on-datetimes-and-int-release-preview?forum=winappswithcsharp
– Rovann Linhalis