This question is locked. New answers and comments are not allowed.
Hi. How do I clear the currently selected item of a DataBoundListBox without screwing up transitions?
Here's the situation. I have a DataBoundListBox with ItemsSource bound to an ObservableCollection on my view model, and the SelectedItem uses TwoWay binding with a property on my view model. When the user clicks an item in the list box SelectedItem changes, and the view model navigates to a different page (standard "list of stuff, click on one to view details" kind of thing). I have a Continuum transition set up, so it flies off the first page and onto the next. Looks great. Then when I back up the title flies back into place.
Problem is I can't click on the same item again - the item is the "selected" item so clicking on it again doesn't produce any changes that the binding can see. So what I thought I'd do is set SelectedItem to null in the code behind (in the OnNavigatedTo method), but this causes the entire list to fade out (takes about a second). So, my question is, when using the Continuum transition what's the proper way to clear the SelectedItem so that the list doesn't fade out?
At the top of both start and end pages I have:
Oh, I also tried "this.ClearValue(RadContinuumAnimation.ContinuumElementProperty);" in OnNavigatedTo but this also causes the list to fade out.
Suggestions?
Here's the situation. I have a DataBoundListBox with ItemsSource bound to an ObservableCollection on my view model, and the SelectedItem uses TwoWay binding with a property on my view model. When the user clicks an item in the list box SelectedItem changes, and the view model navigates to a different page (standard "list of stuff, click on one to view details" kind of thing). I have a Continuum transition set up, so it flies off the first page and onto the next. Looks great. Then when I back up the title flies back into place.
Problem is I can't click on the same item again - the item is the "selected" item so clicking on it again doesn't produce any changes that the binding can see. So what I thought I'd do is set SelectedItem to null in the code behind (in the OnNavigatedTo method), but this causes the entire list to fade out (takes about a second). So, my question is, when using the Continuum transition what's the proper way to clear the SelectedItem so that the list doesn't fade out?
At the top of both start and end pages I have:
<telerikPrimitives:RadTransitionControl.Transition>
<telerikPrimitives:RadContinuumTransition />
</telerikPrimitives:RadTransitionControl.Transition>
The list box:
<telerikPrimitives:RadDataBoundListBox
x:Name=
"ItemListBox"
ItemsSource=
"{Binding Items}"
ItemTemplate=
"{StaticResource ItemListTemplate}"
SelectedItem=
"{Binding SelectedItem, Mode=TwoWay}"
SelectionChanged=
"ItemListBox_SelectionChanged"
>
<telerikPrimitives:RadDataBoundListBox.ItemContainerStyle>
<Style TargetType=
"telerikPrimitives:RadDataBoundListBoxItem"
>
<Setter Property=
"HorizontalContentAlignment"
Value=
"Stretch"
/>
</Style>
</telerikPrimitives:RadDataBoundListBox.ItemContainerStyle>
</telerikPrimitives:RadDataBoundListBox>
private
void
ItemListBox_SelectionChanged(
object
sender, SelectionChangedEventArgs e)
{
RadDataBoundListBoxItem container = ItemListBox.GetContainerForItem(ItemListBox.SelectedItem)
as
RadDataBoundListBoxItem;
this
.SetValue(RadContinuumAnimation.ContinuumElementProperty, container);
}
Oh, I also tried "this.ClearValue(RadContinuumAnimation.ContinuumElementProperty);" in OnNavigatedTo but this also causes the list to fade out.
Suggestions?