天天看點

windows phone (27) 基礎Button

Button 在wp7中因其靈活性經常會用到,我們在ContentPanel中直接添加Button,button預設狀态下是把整個gridview填充完全,比如代碼這樣的代碼

<!--ContentPanel - 在此處放置其他内容-->

        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">

            <Button Content="點選我" BorderBrush="Red" BorderThickness="10"></Button>

        </Grid>

 其呈現效果

windows phone (27) 基礎Button

從上面的圖檔我們可以看出button顯示的文字是textblock,邊緣是border,是以我們還可以繼續給button添加一些屬性,比如字型,背景色,等等一些textblock和border的屬性

 <!--ContentPanel - 在此處放置其他内容-->

            <Button Content="點選我" BorderBrush="DarkGoldenrod"

                    BorderThickness="10" FontSize="50" FontFamily="Portable User Interface"

                    FontStyle="Italic" Foreground="Navy"

                    >

            </Button>

windows phone (27) 基礎Button

                    FontStyle="Italic" Foreground="Navy" Width="300" Height="200" Padding="50 10" Margin="12,0,12,0" ClickMode="Press"

windows phone (27) 基礎Button

 clickMode屬性

Release      指定當按下并松開滑鼠左鍵且滑鼠指針位于控件上方時應引發,如果使用的是鍵盤,則指定在按下并松開空格鍵或 Enter 鍵且控件具有鍵盤焦點時應引發

Press

Hover

Content

<a href="http://msdn.microsoft.com/zh-cn/library/system.object%28v=vs.95%29.aspx">System.Object</a>

          System.Windows.Controls.ContentControl

 凡是繼承此類的元素都可以具有content屬性

 由于PC的項目,已經兩三個月沒有更新wp的文章了,群裡每天都在讨論win 8,wp8 眼饞那

繼續閱讀