c#


Pass text of Listview.ItemTemplate to antoher frame uwp


I have to pass the Text={Binding Id}of textBlock idName from a frame to another frame. the text is an Id from an SQLite database. I have an Listview.ItemTemplate that define the item
<ListView.ItemTemplate>
<DataTemplate>
<Grid Height="Auto" Margin="0,5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="1" VerticalAlignment="Top" Margin="12,0,0,0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock x:Name="idName" Text="{Binding Id}" FontSize="12" VerticalAlignment="Center" Grid.Column="0" Margin="5,0,12,0"/>
<RelativePanel Grid.Column="1">
<TextBlock x:Name="titleBlock" Text="{Binding Title}" FontSize="25" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<TextBlock x:Name="directorLabel" Text="REGISTA:" FontSize="20" RelativePanel.Below="titleBlock" FontWeight="Light"/>
<TextBlock x:Name="directorBlock" Text="{Binding Director}" FontSize="20" RelativePanel.Below="titleBlock" RelativePanel.RightOf="directorLabel"/>
<TextBlock x:Name="yearLabel" Text="ANNO:" FontSize="20" FontWeight="Light" RelativePanel.RightOf="directorBlock" Margin="12,0,0,0" RelativePanel.Below="titleBlock"/>
<TextBlock x:Name="yearBlock" Text="{Binding Year}" FontSize="20" RelativePanel.Below="titleBlock" RelativePanel.RightOf="yearLabel"/>
</RelativePanel>
</Grid>
</StackPanel>
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
I use in the Code Behind this:
this.Frame.Navigate(typeof(FilmInfo), idName.Text);
but idName.Text is an ItemTemplate.
How can I do that?
I'm assuming the item must somehow be selected in the ListView in order to take action on it... if so, you can use the item directly.
YourClassName selectedFilm = YourListView.SelectedItem as YourClassName;
If(selectedFilm != null)
{
this.Frame.Navigate(typeof(FilmInfo), selectedFilm.Id);
}
UPDATE after comment
OK... if you're using the item click event, you can do the same thing...
private void ItemClickEvent(object sender, ItemClickEventArgs e)
{
YourClassName selectedFilm = e.ClickedItem as YourClassName;
if(selectedFilm != null)
{
this.Frame.Navigate(typeof(FilmInfo), selectedFilm.Id);
}
}

Related Links

WebBrowser - show a simple string message without navigating away
Custom context menu not visible in Excel (VSTO C#)
Fastest way to compare two List<CustomObject>
Modeling data to be used in DocumentDB and Azure Search
Learning ASP.NET MVC Entity Framework and Got Hung up on Conflicting Instructions
How to call IEnumerable Collection of Datatable in C#
.Net Standard project : System.Linq.Enumerable class missing
error CS0246: The type or namespace name 'JwtTokenViewModel' could not be found (are you missing a using directive or an assembly reference?)
BeginInvoke does not trigger
Unity - collision failure for fast moving objects
.Net CurrentCulture ShortDateFormat doesn't update according to PC regional settings [duplicate]
Run IIS and Kestrel from command line in Asp.Net Core
VS hides error about a missing type in extension function call?
Is it Possible to Read Specific Block of Text [closed]
Mouse event not working twice
Using a variable number of object fields in a custom editor window

Categories

HOME
drupal
ldap
mysqli
grpc
gap-system
skypedeveloper
grid
msbi
mediarecorder
checkpoint
richtextbox
procmon
mamp
elastalert
email-attachments
drush
chef-recipe
tmux
browsermob
appsettings
smooth-scrolling
loader
url-parameters
gomobile
multipart
ecmascript-2017
grunt-contrib-uglify
symlink
delphi-2010
lines
key-bindings
wordpress-rest-api
ios-autolayout
android-geofence
maven-2
gstreamer-1.0
lighting
framebuffer
blueimp
cowboy
idea-plugin
rbac
socketcluster
directadmin
bzip2
libzip
text-extraction
f#-fake
gradlew
mef
audio-fingerprinting
openpgp.js
seyren
webmatrix
hellosign
reloaddata
ios-keyboard-extension
scrollmagic
stringbuilder
cedar-bdd
computed-properties
optional-parameters
eclipse-mars
altova
angularfire
database-administration
3d-rendering
paypal-subscriptions
web-optimization
custom-build-step
ooad
methodology
nslocalizedstring
jquery-draggable
recode
jain-sip
exchange-server-2007
vanilla-forums
eula
photogrammetry
transparentproxy
jeet-grid
wingdb
dockerpy
nsq
xcode5
javadb
information-hiding
nsurlrequest
worklight-appcenter
indic
im4java
fscanf
rpt
mvcgrid
rda
android-jack-and-jill
codio
ojb
ia-32
select2-rails
string-length
mmo
blotter
openafs
dancer
inserthtml
project-files
log-shipping
pex-and-moles
response-time
conditional-operator
text-manipulation
silverlight-2.0
weak-typing
hotfix

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App