Tilt Effect for Windows Phone

在MSDN上的範例中,可以找到Tilt Effect的範例;不過這個Tile Effect是幹啥用的呢?

Tile Effect是可以幫你的控制項(元素)套用上像是在首頁中的Tile或是程式列表按下去時候的感覺,會有凹下去的樣子,有了這個效果會比較明顯的看出跟使用者間是比較有互動的,那麼要怎麼使用呢?使用的時候您可以先從MSDN上下載範例程式碼,其中就會包含了TiltEffect.cs這個類別檔案,之後將這個檔案加入到你的專案中,之後在XAML的部分設定一下,就會自動套用了喔;設定的方式大致像是下面這樣
要先加入xmlns

xmlns:local="clr-namespace:ControlTiltEffect"

之後,要設定成啟用
llocal:TiltEffect.IsTiltEnabled="True"
是不是很簡單呢,趕緊動手來試試看吧。下面我把PhoneApplicationPage相關的設定整個貼上來,一起參考應該會比較清楚一些

<phone:PhoneApplicationPage
    x:Class="RssReader.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:ControlTiltEffect"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
    d:DataContext="{d:DesignData SampleData/MainViewModelSampleData.xaml}"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="False"
    local:TiltEffect.IsTiltEnabled="True">

另外您也可以參考下面的How-to文章喔
How to: Use the Control Tilt Effect for Windows Phone

留言

這個網誌中的熱門文章

開啟cshtml檔案時,出現『並未將物件參考設定為物件執行個體』的錯誤訊息

無法設定中斷點 尚未載入符號檔

DataGridView欄位計算總合