| 
  Windows Phone SystemTray and ProgressIndicator สำหรับ SystemTray บน Windows Phone เป็นตำแหน่งที่เรียกซึ่งจะอยู่บนเหนือ Titlebar อยู่ติดกับพวกแบตเตอร์รี่ หรือ สัญญาโทรศัพท์  และใน SystemTray  เราสามารถสร้าง ProgressBar แบบ ProgressIndicator (IsIndeterminate) ลักษณะเป็น ลูกบอลเล็ก ๆ หมุ่นไปมา เหมาะสำหรับแสดงผลในขณะที่โปรแกรมกำลังโหลดข้อมูล หรือ กำลังทำงานอยู่ และเราสามารถเขียนโปรแกรมเพื่อควบคุม ProgressIndicator ได้ง่าย ๆ เช่น 
    |  
        Windows Phone SystemTray and ProgressIndicator       |  
 
 
 การแสดง(Show) SystemTray ProgressIndicator
 
 VB.NET
 
         prog = New ProgressIndicator()
        prog.IsVisible = True
        prog.IsIndeterminate = True
        prog.Text = "Downloading...."
        SystemTray.SetProgressIndicator(Me, prog)
C#
 
 prog = new ProgressIndicator();
prog.IsVisible = true;
prog.IsIndeterminate = true;
prog.Text = "Downloading....";
SystemTray.SetProgressIndicator(this, prog);
 
 การซ่อน(Hide) SystemTray ProgressIndicator
 
 VB.NET
 
         prog.IsVisible = False
 C#
 
         prog.IsVisible = false;
 
 Example การแสดง Progress แบบ ProgressIndicator บน SystemTray  แบบง่าย ๆ
 
 ออกแบบหน้าจอและ Layout ดังรูป ซึ่งประกอบด้วย Button 2 ตัวคือ Start และ Stop
 
 
  
 
     <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <!--TitlePanel contains the name of the application and page title-->
        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="page name" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>
        <!--ContentPanel - place additional content here-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
            <Button Content="Start" Height="72" Name="btnStart" Width="160" Click="btnStart_Click" Margin="44,268,252,267" />
            <Button Content="Stop" Height="72" Margin="238,268,58,267" Name="btnStop" Click="btnStop_Click" Width="160" />
        </Grid>
    </Grid>
 
 
 VB.NET
 
     Dim prog As ProgressIndicator
    Private Sub btnStart_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
        SystemTray.SetIsVisible(Me, True)
        'SystemTray.SetBackgroundColor(Me, Colors.Blue)
        'SystemTray.SetForegroundColor(Me, Colors.Yellow)
        prog = New ProgressIndicator()
        prog.IsVisible = True
        prog.IsIndeterminate = True
        prog.Text = "Downloading...."
        SystemTray.SetProgressIndicator(Me, prog)
    End Sub
    Private Sub btnStop_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
        prog.IsVisible = False
    End Sub
 C#
 
         ProgressIndicator prog;
        private void btnStart_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            SystemTray.SetIsVisible(this, true);
            // SystemTray.SetBackgroundColor(Me, Colors.Blue)
            // SystemTray.SetForegroundColor(Me, Colors.Yellow)
            prog = new ProgressIndicator();
            prog.IsVisible = true;
            prog.IsIndeterminate = true;
            prog.Text = "Downloading....";
            SystemTray.SetProgressIndicator(this, prog);
        }
        private void btnStop_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            prog.IsVisible = false;
        }
 Code ที่เป็น VB.NET และ C#
 
 Screenshot
 
 
  
 ทดสอบการทำงานด้วยการคลิกที่ Start
 
 
  
 แสดง SystemTray and ProgressIndicator และกดปุ่ม Stop เพื่อหยุดการทำงาน
 
 
 
 สำหรับ SystemTray ProgressIndicator เหมาะสมสำหรับการแสดงในขณะที่โปรแกรมกำลังทำงานหรือโหลดข้อมูล เช่นในขณะที่กำลังโหลดข้อมูลจาก Server ก็อาจจะโชว์ ProgressIndicator เพื่อให้ผู้ใช้ทราบว่ากำลังมีการโหลดข้อมูล และเมื่อโหลดข้อมูลเสร้จสิ้นแล้วก็ให้ซ่อน ProgressIndicator  ออกจากหน้าจอ Application
 
 
 
 
 |