Skip to content

Instantly share code, notes, and snippets.

View rkusa's full-sized avatar
💭
Busy with non-Github stuff. Very slow to respond.

Markus Ast rkusa

💭
Busy with non-Github stuff. Very slow to respond.
View GitHub Profile
AccessDeniedInvalid according to Policy: Policy Condition failed: ["eq", "$key", "downloads/brainafk/BrainafkPhoneToolkit/C:\u000Cakepath\r2-binaries.zip"]1DF069746D6A58D64Z+SO1mNq0TN587kZrPs1xNpCxYDBs8u9gr1BMBEw0LjM5kLbhOHE2RV5YeXUtm1
<toolkit:PickerBox ItemsSource="{Binding FirstItems}" SelectedItem="{Binding FirstSelected}"
Foreground="Black" FontSize="36"
IsApplicationBarVisible="True" />
MainListBox.ItemContainerStyle.Setters.Add(new Setter(ListBoxItem.OpacityProperty, 0));
<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>
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;
<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>
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)));
_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;
MainListBox.ItemContainerGenerator.ItemsChanged += ItemContainerGenerator_ItemsChanged;
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;