Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Revision as of 11:01, 2 July 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Multiline TextBlock pada Silverlight for Windows Phone

From Wiki
Jump to: navigation, search

Artikel ini menjelaskan bagaimana caranya untuk membuat sebuah TextBlock menjadi multiline pada Silverlight for Windows Phone.

WP Metro Icon UI.png
SignpostIcon XAML 40.png
SignpostIcon WP7 70px.png
Article Metadata

Kecocokan
Platform(s): Windows Phone 7.5
Windows Phone 7.5

Artikel
Kata Kunci: TextBlock, Multiline
Created: Jeffrey.Halimsetiawan (23 Sep 2012)
Perubahan Terakhir: hamishwillee (02 Jul 2013)

Pendahuluan

Ada kalanya, kita perlu untuk menampilkan sebuah informasi kepada pengguna dalam beberapa baris pada sebuah. Lalu, bagaimana cara menampilkan Multiline TextBlock melalui C# code?

Prosedur

Berikut adalah langkah-langkahnya:

  1. Tambahkan sebuah TextBlock pada PhoneApplicationPage dengan drag & drop dan beri nama txbUnlockStatus.
    MultiLineTextBlock1.png
  2. Tambahkan kode berikut untuk membuat TextBlock terdiri dari 2 baris string.
    txbUnlockStatus.Text = string.Empty;
    Run r = new Run();
    r.Text = "Ghost Buster medal is unlocked";
    txbUnlockStatus.Inlines.Add(r);
    txbUnlockStatus.Inlines.Add(new LineBreak());
    r = new Run();
    r.Text = "Ghost Enthusiast medal is unlocked";
    txbUnlockStatus.Inlines.Add(r);

Selamat mencoba!

This page was last modified on 2 July 2013, at 11:01.
174 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×