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
public class IncrementalLoadingBehavior : Behavior<LongListSelector> | |
{ | |
public ICommand LoadCommand { get; set; } | |
protected override void OnAttached() | |
{ | |
base.OnAttached(); | |
AssociatedObject.ItemRealized += OnItemRealized; | |
} |
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
<i:Interaction.Behaviors> | |
<b:IncrementalLoadingBehavior LoadCommand="{Binding LoadCommand}" /> | |
</i:Interaction.Behaviors> |
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
<phone:LongListSelector cal:Message.Attach="[Event ItemRealized]=[Action LoadMoreItems($eventArgs)]" /> |
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
public class IncrementalLoadingTrigger : TriggerBase<LongListSelector> | |
{ | |
protected override void OnAttached() | |
{ | |
base.OnAttached(); | |
AssociatedObject.ItemRealized += OnItemRealized; | |
} | |
private void OnItemRealized(object sender, ItemRealizationEventArgs e) | |
{ |
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
<i:Interaction.Triggers> | |
<t:IncrementalLoadingTrigger> | |
<cal:ActionMessage MethodName="LoadMoreItems"/> | |
</t:IncrementalLoadingTrigger> | |
</i:Interaction.Triggers> |
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
public ViewModel() | |
{ | |
Init(); | |
} | |
private async void Init() | |
{ | |
var file = await Package.Current.InstalledLocation.GetFileAsync(@"Assets\Text.txt"); | |
Text = await FileIO.ReadTextAsync(file); | |
} |
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
public class BooleanToVisibilityConverter : IValueConverter | |
{ | |
public bool Inverted { get; set; } | |
public object Convert(object value, Type targetType, object parameter, string language) | |
{ | |
if (!(value is bool)) | |
{ | |
return Visibility.Collapsed; | |
} |
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
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}"> | |
<ProgressBar Value="{Binding Progress}" | |
Minimum="0" | |
Maximum="1" | |
Visibility="{Binding Initialized, Converter={StaticResource InvertedBoolToVisibilityConverter}}"/> | |
<TextBlock Text="{Binding Text}" | |
TextWrapping="Wrap" | |
Visibility="{Binding Initialized, Converter={StaticResource BoolToVisibilityConverter}}" | |
Style="{StaticResource BasicTextStyle}" /> | |
</Grid> |
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 readonly Task _initializingTask; | |
public ViewModel() | |
{ | |
_initializingTask = Init(); | |
} | |
private async Task Init() | |
{ | |
var file = await Package.Current.InstalledLocation.GetFileAsync(@"Assets\Text.txt"); |
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 file = await Package.Current.InstalledLocation.GetFileAsync(@"\Assets\Text.txt"); | |
file.CopyAsync(ApplicationData.Current.LocalFolder); |
OlderNewer