小编Mih*_*hir的帖子

使文本块的宽度自动化

如何将动态创建的文本块的高度和宽度设置为自动?

TextBlock myTextBlock = new TextBlock() { Text = "Text Block", Width = 140, Height = 40, FontSize = 20 };
Run Code Online (Sandbox Code Playgroud)

c# xaml windows-phone-8

6
推荐指数
1
解决办法
1755
查看次数

如何为动态创建的 TextBlock 提供点击(或点击)事件

public void myTextBlock1_Tap(object sender, System.Windows.Input.GestureEventArgs e)
    {

        StackPanel mystack = new StackPanel() { Height = 100, Width = 200 };
        TextBlock myTextBlock1 = new TextBlock() 
            { Text = "Text Block", Width = 350, Height = 40, FontSize = 20,
              VerticalAlignment = VerticalAlignment.Center, 
              TextAlignment = TextAlignment.Center, 
              HorizontalAlignment = HorizontalAlignment.Center, };
        mystack.Children.Add(myTextBlock1);
    }


for (int r = 0; r < m; r++)
        {
            TextBlock myTextBlockr = new TextBlock() 
                { Text = "Text Block", Width = 350, Height = 40, FontSize = 20, …
Run Code Online (Sandbox Code Playgroud)

c# xaml windows-phone-8 uwp

5
推荐指数
0
解决办法
1386
查看次数

标签 统计

c# ×2

windows-phone-8 ×2

xaml ×2

uwp ×1