0

Ich arbeite an einem Projekt, in dem ich Inhalt mit JSON Binding in der Grid-Ansicht setze, aber jetzt möchte ich Text von Element, wenn es ausgewählt ist. XAML CODE:Wie erhält man Text in GridView, wenn ausgewählt?

<GridView ItemsSource="{Binding}" HorizontalAlignment="Center" Margin="0,10,0,0" x:Name="dataList" VerticalAlignment="Center" SelectionMode="None" SelectionChanged="dataList_Selection"> 
     <GridView.ItemTemplate> 
      <DataTemplate> 
       <StackPanel Width="450" Height="300"> 
        <Image Source="{Binding Top}" Margin="0,0,0,0" Stretch="None" /> 
        <TextBlock x:Name="title" Text="{Binding Title}" Foreground="Black" HorizontalAlignment="Center" FontFamily="Assets/Font/MixBrush.ttf#MixBrush" FontWeight="Bold" FontSize="50" Margin="0,10,0,0" /> 
       <Image Source="{Binding Bottom}" Margin="0,0,0,0" Stretch="None" /> 
        <TextBlock Text="{Binding first}" Foreground="Black" HorizontalAlignment="Center" FontFamily="Assets/Font/Comfortaa_Regular.ttf#Comfortaa" FontSize="20" Margin="0,50,0,0" /> 
        <TextBlock Text="{Binding second}" Foreground="Black" HorizontalAlignment="Center" FontFamily="Assets/Font/Comfortaa_Regular.ttf#Comfortaa" FontSize="20" Margin="0,0,0,0" /> 
        <TextBlock Text="{Binding third}" Foreground="Black" HorizontalAlignment="Center" FontFamily="Assets/Font/Comfortaa_Regular.ttf#Comfortaa" FontSize="20" Margin="0,0,0,0" /> 
       </StackPanel> 
      </DataTemplate> 
     </GridView.ItemTemplate> 
    </GridView> 

Hier möchte ich Text von "Titel" programmgesteuert erhalten. Bitte teilen Sie Ihr Wissen mit mir. :-)
********************** Danke ******************* *****

Antwort

0

auf dem Rücken Code:

title.Text; 
+0

Für Ihre sehr freundliche Informationen benutze ich "Titel" in Datenvorlage und es ist nicht programmgesteuert erreichbar .. !! :) –

+0

"Für Ihre sehr freundliche Informationen": D: D: D Entschuldigung, habe ich nicht bemerkt :) – SeM

+0

Kein Problem, bro .. :) –

0

Nach langen, harten Kampf fand ich meine Antwort.

var selection = (myClass) dataList.SelectedItem; 
await new MessageDialog(selection.Title).ShowAsync(); 

Und ich habe ein perfektes Ergebnis.

Vielen Dank.