Windows Phone 7編程學習點滴二——裝置方向、系統主題和系統托盤

來源:互聯網
上載者:User

標籤:

1 有兩種方式可以改變裝置的方向:

(1) 將SupportedOrientation設定為“PortraitOrLandscape”讓作業系統為你實現。

(2) 是通過代碼實現: OrientationChanged 事件。

1 this.OrientationChanged += new EventHandler<OrientationChangedEventArgs>(MainPage_OrientationChanged);  
 1 void MainPage_OrientationChanged(object sender, OrientationChangedEventArgs e)   2 {   3             if ((e.Orientation == PageOrientation.LandscapeRight) || (e.Orientation == PageOrientation.LandscapeLeft))   4             {   5                 TitlePanel.Visibility = Visibility.Collapsed;   6             }   7             else if ((e.Orientation == PageOrientation.PortraitDown) || (e.Orientation == PageOrientation.PortraitUp))   8             {   9                 TitlePanel.Visibility = Visibility.Visible;  10             }  11         }  12 }  

2 系統主題

在Visual Studio中右擊此項目,選擇“Open In Expression Blend…” 或在View菜單中選擇“Open In Expression Blend…”。

在Blend的UI中有一個標籤叫“Device”,看起來像這樣:

<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-->  <Rectangle Stroke="Black" Grid.RowSpan="2">  <Rectangle.Fill>  <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">  <GradientStop Color="{StaticResource PhoneBackgroundColor}" Offset="0"/>  <GradientStop Color="{StaticResource PhoneAccentColor}" Offset="1"/>  </LinearGradientBrush>  </Rectangle.Fill>  </Rectangle>  <!--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="BLANKENSOFT" Style="{StaticResource PhoneTextNormalStyle}" mce_Style="{StaticResource PhoneTextNormalStyle}"/>  <TextBlock x:Name="PageTitle" Text="system theming" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}" mce_Style="{StaticResource PhoneTextTitle1Style}">  <TextBlock.Foreground>  <SolidColorBrush Color="{StaticResource PhoneAccentColor}"/>  </TextBlock.Foreground>  </TextBlock>  </StackPanel>  <!--ContentPanel - place additional content here-->  <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">  <TextBlock Height="601" TextWrapping="Wrap" HorizontalAlignment="Left" Margin="0,6,0,0" x:Name="textBlock1" Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur mollis turpis sit amet diam elementum molestie. Cras quis massa ante. Morbi sit amet arcu quam, non dignissim nibh. Nunc lectus leo, ornare quis imperdiet id, fringilla vel diam. Proin vitae augue non sem sollicitudin imperdiet ut quis diam. Nulla vitae nulla eros. Curabitur mauris justo, eleifend eu sodales ac, blandit vitae mauris. Pellentesque erat lorem, euismod at sodales eget, sollicitudin sed velit. Praesent est sapien, hendrerit tempor tincidunt quis, posuere ac nunc. Nam odio nisl, feugiat eget blandit sit amet, dapibus id tellus. Sed blandit nisi nunc. Aliquam fermentum justo tristique risus porta sollicitudin. Aenean aliquam congue ornare. Curabitur blandit mi quis odio convallis adipiscing." VerticalAlignment="Top" Width="468" />  </Grid>  </Grid>  

系統托盤

shell:SystemTray.IsVisible

Windows Phone 7編程學習點滴二——裝置方向、系統主題和系統托盤

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.