TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ABHIJIT POOJARI
1.7k
33
1.9k
Window 8.1 app development
Oct 26 2017 1:01 AM
I have use sqlite and visualstudio 2015. I have displayed the required data using listview.
Now i want to display data of only the selected item in listview when i click the display the data(Button).
when i click showdata button(btnAdd_Click) listview is displayed.
Display.xaml
<
Grid
Background
=
"Gray"
>
<
Button
x:Name
=
"btn"
Click
=
"btnAdd_Click"
Content
=
"Showdata"
Width
=
"200"
Margin
=
"900,43,0,687"
Background
=
"#FF040404"
/>
<
ListView
Header
=
"Detailss"
x:Name
=
"myList"
HorizontalAlignment
=
"Left"
>
<
ListView.ItemTemplate
>
<
DataTemplate
>
<
StackPanel
Orientation
=
"Vertical"
Height
=
"150"
Width
=
"200"
Background
=
"White"
>
<
TextBlock
x:Name
=
"username"
HorizontalAlignment
=
"Left"
Text
=
"{Binding Username}"
TextWrapping
=
"Wrap"
Foreground
=
"Black"
/>
<
TextBlock
x:Name
=
"password"
Text
=
"{Binding Password}"
TextWrapping
=
"Wrap"
Foreground
=
"Black"
/>
<
TextBlock
x:Name
=
"name"
Text
=
"{Binding Name}"
TextWrapping
=
"Wrap"
Foreground
=
"Black"
/>
<
TextBlock
x:Name
=
"address"
Text
=
"{Binding Address}"
TextWrapping
=
"Wrap"
Foreground
=
"Black"
/>
<
Button
x:Name
=
"btn1"
Content
=
"Display This Data"
Background
=
"#FFA68A8A"
Foreground
=
"#FF060606"
Click
=
"btn1Add_Click"
/>
</
StackPanel
>
</
DataTemplate
>
</
ListView.ItemTemplate
>
</
ListView
>
Display.xaml.cs
string
DB_Path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path,
"Winapp.sqlite"
);
private
void
btnAdd_Click(
object
sender, RoutedEventArgs e)
{
ObservableCollection<RegisterTable> obsregtable =
new
ObservableCollection<RegisterTable>();
using
(SQLite.Net.SQLiteConnection conn =
new
SQLite.Net.SQLiteConnection(
new
SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), DB_Path))
{
List<RegisterTable> RegisterData = conn.Query<RegisterTable>(
"select * from RegisterTable"
);
foreach
(var item
in
RegisterData)
{
obsregtable.Add(
new
RegisterTable() { Id = item.Id, Name = item.Name, Username = item.Username, Password = item.Password, Address = item.Address });
}
myList.ItemsSource = obsregtable;
}
private
async
void
btn1Add_Click(
object
sender, RoutedEventArgs e)
{
}
Reply
Answers (
1
)
Why Datatable and DataSet is removed from UWP?
Web platform installer 5.0 not working in windows 8.1