Introduction
I have already posted this kind of article here and it is a very nice example of making a custom loader. However we need to provide some kind of progress/loaders until the user data is loaded. It is good practices for the user to be informed of his data as it is loaded from the web. In a previous article I introduce the loader without related text. But now I thought It's better to show related text with the loader, so the user can get an idea of the data he is waiting on.
Requirements
- This sample is targeted to the Windows Phone 7.1 OS
- Additionally I am using a MessagePrompt to display a custom loader. So we need to add the Coding4fun Toolkit to use the "MessagePrompt".
Step 1
First I made a usercontrol named "UcCustomLoaderWithText". In this control I rotate the image using "Storyboard" like this:
XAML Code
- <Grid HorizontalAlignment="Left" Background="Transparent">
- <Grid.RowDefinitions>
- <RowDefinition Height="Auto"/>
- </Grid.RowDefinitions>
- <Canvas Grid.Row="0" RenderTransformOrigin="0.5,0.5" Margin="0,0,0,0" Width="50" Height="50" HorizontalAlignment="Left" VerticalAlignment="Center" d:LayoutOverrides="Margin">
- <Canvas.RenderTransform>
- <RotateTransform x:Name="SpinnerRotate" Angle="0" />
- </Canvas.RenderTransform>
- <Canvas.Triggers>
- <EventTrigger RoutedEvent="Canvas.Loaded">
- <BeginStoryboard>
- <Storyboard>
- <DoubleAnimation Storyboard.TargetName="SpinnerRotate"
- Storyboard.TargetProperty="(RotateTransform.Angle)"
- From="0" To="360" Duration="0:0:01"
- RepeatBehavior="Forever" />
- </Storyboard>
- </BeginStoryboard>
- </EventTrigger>
- </Canvas.Triggers>
- <Image x:Name="ImageLoader" HorizontalAlignment="Center" Width="50" Height="50" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" Source="/Images/imgCustomLoader2.png">
- <Image.RenderTransform>
- <CompositeTransform/>
- </Image.RenderTransform>
- </Image>
- </Canvas>
- <TextBlock Name="TBlckLoaderText" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="55,0,0,0" Grid.Row="0" Text="Loading ..." Foreground="Black" TextWrapping="Wrap"/>
- </Grid>



Suresh MPosted Nov 25, 2014, 2:04 AM
with out using back button how to stop the loader in same screen?
Subramanyam RajuPosted Nov 25, 2014, 1:48 AM
When user press back button,it will be close.
Suresh MPosted Nov 25, 2014, 1:26 AM
hi how to stop this custom loader.?
Vithal WadjePosted Nov 24, 2014, 6:57 AM
thanks SubramanyamRaju B sir,hope in future i will see your more articles
Subramanyam RajuPosted Nov 24, 2014, 3:40 AM
Thanks Dinesh :)
Dinesh BeniwalPosted Nov 24, 2014, 3:15 AM
Good start Subramanyam, Welcome to C# Corner.
Vithal WadjePosted Nov 23, 2014, 11:30 PM
yes,welcome and thanks
Subramanyam RajuPosted Nov 23, 2014, 11:17 PM
Ok Thanks,In next time i will do it and it is first time for me to write article in c-sharpcorner
Vithal WadjePosted Nov 21, 2014, 3:42 PM
you can upload source code along with this article as wel no need to give your blog link,because some times it gives the problem when we are downloading the code from office PC from blogspot because in office blogger sites are blocked means don't have an access of this