Hello, I am developing a UWP application for Windows 10.
I have embedded a textbox into a Listview, but I can't get the value of this textbox (probably due to the fact that the textbox is in a DataTemplate).
Thanks for helping me, this is my first UWA app (I was developing before in Silverlight), it's been several days since I've been looking for a solution on all forums, but I haven't found anything that works.
Here is an excerpt from my XAML:
<PivotItem Header="Favoris" Margin="0,0,0,0">
<SemanticZoom Name="szFavoris" Height="500">
<SemanticZoom.ZoomedInView>
<ListView x:Name="listBoxobjFav"
ItemsSource="{Binding Source={StaticResource cvsFavoris}}"
BorderBrush="#FF141EE4" Width="360" Height="495" Margin="0,10,0,0" VerticalAlignment="Top"
IsItemClickEnabled="True" SelectionMode="Multiple" SelectionChanged="listBoxobjFav_SelectionChanged">
<ListView.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="210" />
<ColumnDefinition Width="80" />
</Grid.ColumnDefinitions>
<TextBlock x:Name="NameTxt" Grid.Column="0" Margin="0,0,0,0" TextWrapping="Wrap" Text="{Binding Name}" FontSize="20" Foreground="White"/>
<TextBox Grid.Column="1"
x:Name="QteArt"
Text="{Binding QteArt, Mode=TwoWay}"
HorizontalAlignment="Right"
FontSize="16"
Foreground="DarkGray"
InputScope="Number"
Visibility="Visible"
PlaceholderText="{Binding UniteMesure}"
/>
<!--
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.GroupStyle>
<GroupStyle>
<GroupStyle.HeaderTemplate>
<DataTemplate>
<TextBlock Text="{Binding Key}" Foreground="CadetBlue" FontSize="18" />
</DataTemplate>
</GroupStyle.HeaderTemplate>
</GroupStyle>
</ListView.GroupStyle>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="FocusVisualPrimaryBrush" Value="Transparent"/>
</Style>
</ListView.ItemContainerStyle>
</ListView>
</SemanticZoom.ZoomedInView>
<SemanticZoom.ZoomedOutView>
<ListView x:Name="listBoxCatFav" SelectionMode="None" Width="360" Height="500" IsItemClickEnabled="True" BorderBrush="#FF141EE4" >
<ListView.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Margin="15,20,0,0" x:Name="CatTxt" Text="{Binding Group.Key}" TextWrapping="Wrap" Foreground="CadetBlue" FontSize="18"/>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</SemanticZoom.ZoomedOutView>
</SemanticZoom>
</PivotItem>
What I have tried:
I have defined a UserControl, which contains the entire DataTemplate, but I am unable to embed this UserControl in the DataTemplate.