Visual Studio visual table of SQL in the Windows 10 universal project



  • We need to visualize the SQLite table as a table. There are similar issues in this service, but the problem is: the Windows 10 universal project does not support DataGridView. For me, the remaining obvious options from the same direction are GridView and Grid. Grid is obviously not appropriate, and GridView is not clear whether it will be possible to deal with this task... and if it may not understand how to proceed in this direction.

    Question, how can the sqlite tables be visualized with a sufficiently large volume of information (3 and more lines)?



  • I hope you're familiar with data links (bindings). UWP applications have produced compilable data links that work faster. You 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;}
    }
    

    }

    Further, in XAML add GridView or as in the following example, ListView, with a stack of one element 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're not going to need a simple collection, but Observable.

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

    If you look at XAML, it's connected with the data - ItemsSource="

    And somewhere in the code, you can now ask the context of the data:

    this.DataContext = mydata;

    and add any data:

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

    If you're interested in choosing the data from SQLite to UWP, you can use it. http://sqlite.org/download.html Roll and set up vsix. Adding the reference and space of names

    using SQLitePCL;

    And count the data in the cycle.

    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] });
    }
    }




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2