You need to visualize SQLite table data as a table. There are similar issues in this service, but the problem is this: the universal project of Windows 10 does not support DataGridView. For me, the remaining obvious options from the same direction are GridView and Grid. Grid obviously does not fit, but with GridView it is not clear whether it will be able to cope with such a task ... and if it can, it is not clear how to act in this direction.

The question is, how can you visualize the data in the sqlite table with a sufficiently large amount of information (3 thousand and more rows)?

    1 answer 1

    I hope that you are familiar with data bindings (binding). Compiled data bindings have appeared in UWP applications that work faster. Create a class with a data structure.

    public class ClassInfo { private string _name; private int _surname; public string Name { get { return _name; } set { _name = value;} } public int Surname { get { return _surname; } set { _surname = value;} } } 

    Next in XAML, add a GridView or, as in the following example, a ListView with a single item template inside:

     <ListView ItemsSource="{x:Bind mydata}" Width="200" Height="500"> <ListView.ItemTemplate> <DataTemplate x:DataType="local:ClassInfo"> <StackPanel Orientation="Vertical"> <TextBlock Text="{x:Bind Name}" x:Phase="0" ></TextBlock> <TextBlock Text="{x:Bind Surname}" x:Phase="1" ></TextBlock> </StackPanel> </DataTemplate> </ListView.ItemTemplate> 

    You will need not a simple collection, but an Observable (as it changes the UI, the XAML changes as well):

     ObservableCollection<ImageInfo> mydata = new ObservableCollection<ImageInfo>(); 

    If you look at XAML, then the data is attached to it - ItemsSource = "{x: Bind mydata}".

    Well, somewhere in the code you can now set the data context:

     this.DataContext = mydata; 

    and add some data:

     mydata.Add(new ClassInfo { Name = "Алексей", Surname = "Соммер" }); 

    If you are interested in how to select data from SQLite in UWP, you can do this using the SQLite for Universal Windows Platform. Download and install vsix. Add link and namespace

     using SQLitePCL; 

    And read the data in a loop

     using (var statement = conn.Prepare("SELECT Name, Surname FROM People WHERE FirstName='Alex'")) { while (statement.Step() == SQLiteResult.ROW) { mydata.Add(new ClassInfo { Name = (string)statement[0], Surname = (string)statement[1] }); } }