I have a dropdown menu
and a ListPicker
with two values: A and B.
When I select something from the menu, my values appear. When I select a value, it appears in a textbox (A or B).
If I click to top of value A, the value dissapears, why?
This is what I have in XAML
:
<toolkit:ListPicker x:Name="Select" Visibility="Collapsed" >
<toolkit:ListPickerItem Content="A"/>
<toolkit:ListPickerItem Content="B"/>
</toolkit:ListPicker>
In the code, the ListPicker
is set to visibile, TextBox
gets the selected value and shows the content.
I've made a video to explain this issue. Any solution? Thanks!
I think that might help you
<TextBox x:Name="myTextBox" Text="{Binding}"/>
<toolkit:ListPicker x:Name="Select" Visibility="Collapsed" SelectionChanged="Select_SelectionChanged">
<toolkit:ListPickerItem Content="A"/>
<toolkit:ListPickerItem Content="B"/>
Then write the following c# code on the SelectionChanged Event Handler for the listpicker.
private void Select_SelectionChanged()
{
myTextBox.DataContext = ((ListPickerItem)Select.SelectedItem).Content.ToString();
}
or if if refuses try this one out
private void Select_SelectionChanged()
{
myTextBox.DataContext = Select.SelectedValue.ToString();
}