私はちょっとこれをやってみましたが、あまりコードはありません。私はあなたに私のMeds.xamlとMeds.xaml.csコードを示します。リストビューにデータをバインドするための助けを得ることができるかどうかを確認してください。基本的には、フォームが入力され、ボタンがクリックされ、データベースに追加され、ListViewが更新されます。Windowsユニバーサルアプリケーション - リストビューでSQLiteデータを表示
Meds.xaml
<TextBlock x:Name="textBlock1" HorizontalAlignment="Left" TextWrapping="Wrap" Text="Medication Name:" VerticalAlignment="Top" Margin="43,255,0,0" Foreground="#FFC6C6C6" FontSize="18.667"/>
<TextBox x:Name="medname_box" HorizontalAlignment="Left" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Margin="265,248,0,0" Width="186"/>
<TextBlock x:Name="textBlock1_Copy" HorizontalAlignment="Left" TextWrapping="Wrap" Text="Medication Total Dose:" VerticalAlignment="Top"
....とに、私は、データが今
</Grid>
を表示する
<ListView x:Name="listView" HorizontalAlignment="Left" Height="464" VerticalAlignment="Top" Width="283" Margin="655,217,0,0" SelectionChanged="listView_SelectionChanged"/>
に、ここでのクスリです.xaml.cs public sealed partial class Meds : Page
{
string path;
SQLite.Net.SQLiteConnection conn;
public Meds()
{
this.InitializeComponent();
path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path,
"meds.sqlite");
conn = new SQLite.Net.SQLiteConnection(new
SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path);
conn.CreateTable<Medications>();
var query = conn.Table<Medications>();
string id = "";
string MedName = "";
string MedDose = "";
int AM;
int Noon;
int Supper;
int Night;
int PRN;
int Other;
string WhatFor = "";
}
private void button1_Click(object sender, RoutedEventArgs e)
{
if (Frame.CanGoBack)
{
Frame.GoBack();
}
}
private void button2_Click(object sender, RoutedEventArgs e)
{
var z = conn.Insert(new Medications()
{
MedName = medname_box.Text,
MedDose = meddose_box.Text,
は、チェックボックスはまだ...
// AM = ,
// Noon = "",
// Supper = "",
// Night = "",
// PRN = "",
// Other = "",
WhatFor = whatfor_box.Text
});
// var query = conn.Table<Medications>();
// string id = "";
// string CurrentMood = "";
// foreach (var message in query)
// {
// id = id + " " + message.Id;
// CurrentMood = message.MedName;
// }
}
private void listView_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
}
}
public class Medications
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string MedName { get; set; }
public string MedDose { get; set; }
public int AM { get; set; }
public int Noon { get; set; }
public int Supper { get; set; }
public int Night { get; set; }
public int PRN { get; set; }
public int Other { get; set; }
public string WhatFor { get; set; }
}
そして、あなたの質問は...?もう少し正確にしてコメントアウトしたような不要なコードを削除してください。 –