This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var observable = Observable.GenerateWithTime(0, x => x < yourListBox.Items.Count, x => x, x => TimeSpan.FromMilliseconds(50), x => x + 1); | |
observable.Subscribe(i => Dispatcher.BeginInvoke(() => | |
VisualStateManager.GoToState( | |
(ListBoxItem)yourListBox.ItemContainerGenerator | |
.ContainerFromIndex(i), "AfterLoaded", true))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GeneralTransform elementTransform = element.TransformToVisual(container); | |
Rect rect = elementTransform.TransformBounds(new Rect(new Point(0, 0), element.RenderSize)); | |
rect.Intersect(new Rect(new Point(0, 0), MainListBox.RenderSize)); | |
return rect != Rect.Empty; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_firstInViewport = 0; | |
_lastInViewport = MainListBox.Items.Count - 1; | |
// determine first visible item | |
for (int i = 0; i < MainListBox.Items.Count; i++) | |
{ | |
ListBoxItem item = (ListBoxItem)MainListBox.ItemContainerGenerator.ContainerFromIndex(i); | |
if (item == null || !IsVisibleInViewPort(item, MainListBox)) | |
continue; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var observable = Observable.GenerateWithTime(_firstInViewport, x => x <= _lastInViewport, x => x, | |
x => TimeSpan.FromMilliseconds(50), x => x + 1); | |
observable.Subscribe(i => Dispatcher.BeginInvoke(() => | |
VisualStateManager.GoToState( | |
(ListBoxItem)MainListBox.ItemContainerGenerator | |
.ContainerFromIndex(i), "AfterLoaded", true))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (int i = _firstInViewport; i <= _lastInViewport; i++) | |
{ | |
ListBoxItem item = (ListBoxItem)MainListBox.ItemContainerGenerator.ContainerFromIndex(i); | |
if (item == null) | |
continue; | |
VisualStateManager.GoToState(item, "BeforeLoaded", false); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<toolkit:PickerBox ItemsSource="{Binding FirstItems}" SelectedItem="{Binding FirstSelected}" | |
Foreground="{StaticResource PhoneContrastForegroundBrush}" | |
FontSize="36" Margin="0,0,0,48" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<toolkit:PickerBox ItemsSource="{Binding SecondItems}" SelectedItem="{Binding SecondSelected}" Foreground="{StaticResource PhoneContrastForegroundBrush}"> | |
<toolkit:PickerBox.ItemTemplate> | |
<DataTemplate> | |
<StackPanel x:Name="stackPanel" Orientation="Horizontal" Margin="10,10" Width="440"> | |
<Rectangle Fill="{Binding Brush}" Width="42" Height="42" /> | |
<TextBlock Text="{Binding Name}" FontSize="36" VerticalAlignment="Center" Margin="25,0,0,0" /> | |
</StackPanel> | |
</DataTemplate> | |
</toolkit:PickerBox.ItemTemplate> | |
</toolkit:PickerBox> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Style TargetType="controls:PickerBox"> | |
<Setter Property="Template"> | |
<Setter.Value> | |
<ControlTemplate TargetType="controls:PickerBox"> | |
<StackPanel> | |
<VisualStateManager.VisualStateGroups> | |
<VisualStateGroup x:Name="ButtonStates"> | |
<VisualStateGroup.Transitions> | |
<VisualTransition GeneratedDuration="0:0:0.1"/> | |
</VisualStateGroup.Transitions> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MainListBox.ItemContainerGenerator.ItemsChanged += ItemContainerGenerator_ItemsChanged; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void ItemContainerGenerator_ItemsChanged(object sender, ItemsChangedEventArgs e) | |
{ | |
Dispatcher.BeginInvoke(new ItemAddedDelegate(i => | |
{ | |
var item = (ListBoxItem) MainListBox.ItemContainerGenerator.ContainerFromIndex(i - 1); | |
if (item == null) | |
return; | |
VisualStateManager.GoToState(item, "BeforeLoaded", false); | |
item.Opacity = 1.0; |