当前位置: 首页>>代码示例>>C#>>正文


C# TextBlock类代码示例

本文整理汇总了C#中TextBlock的典型用法代码示例。如果您正苦于以下问题:C# TextBlock类的具体用法?C# TextBlock怎么用?C# TextBlock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TextBlock类属于命名空间,在下文中一共展示了TextBlock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnNavigatedTo

 /// <summary>
 /// Called when this page is navigated to.
 /// Fills out form fields with recognition results.
 /// </summary>
 /// <param name="e"></param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     // call default behaviour
     base.OnNavigatedTo(e);
     // clear form fields
     mContent.Children.Clear();
     // if results have been passed copy them to form fields
     if (results != null) {
         StackPanel typePanel = new StackPanel() { HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, Margin = new Thickness(0, 0, 0, 40) };
         TextBlock typeLabel = new TextBlock() { Text = "Result Type: " + resultsType, HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, TextWrapping = TextWrapping.Wrap, FontSize = 27 };
         typePanel.Children.Add(typeLabel);
         mContent.Children.Add(typePanel);
         foreach (var key in results.Keys) {
             if (key != null && results[key] != null) {
                 StackPanel panel = new StackPanel() { HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, Margin = new Thickness(0, 0, 0, 20) };
                 TextBlock label = new TextBlock() { Text = key, HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, TextWrapping = TextWrapping.Wrap };
                 TextBox textbox = new TextBox() { Text = results[key].ToString(), HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, TextWrapping = TextWrapping.Wrap };
                 panel.Children.Add(label);
                 panel.Children.Add(textbox);
                 mContent.Children.Add(panel);
             }
         }
     } else {
         StackPanel typePanel = new StackPanel() { HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, Margin = new Thickness(0, 0, 0, 40) };
         TextBlock typeLabel = new TextBlock() { Text = "No results found", HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch, TextWrapping = TextWrapping.Wrap, FontSize = 27 };
         typePanel.Children.Add(typeLabel);
         mContent.Children.Add(typePanel);
     }
 }
开发者ID:BlinkID,项目名称:blinkid-windowsPhone,代码行数:34,代码来源:ResultsPage.xaml.cs

示例2: btch_item

        public btch_item(stat_home m, int i, String btch_name)
        {
            main = m;
            item = new Grid();
            this.btch_name = btch_name;

            item.Height = 60;
            item.Width = 456;
            item.HorizontalAlignment = HorizontalAlignment.Left;
            item.VerticalAlignment = VerticalAlignment.Top;
            item.Margin = new Thickness(10, 10 + i * 90, 0, 0);

            name = new TextBlock();
            item.Children.Add(name);

            name.Height = 60;
            name.Width = 456;
            name.TextWrapping = TextWrapping.NoWrap;
            name.FontSize = 40;
            name.Margin = new Thickness(0, 0, 0, 0);
            name.Foreground = new SolidColorBrush(Colors.White);
            name.HorizontalAlignment = HorizontalAlignment.Left;
            name.VerticalAlignment = VerticalAlignment.Top;
            name.MouseLeftButtonDown += new MouseButtonEventHandler(expand);

            name.Text = btch_name;

        }
开发者ID:rashoodkhan,项目名称:Attendance,代码行数:28,代码来源:stat_home.xaml.cs

示例3: Execute

		public bool Execute()
		{
			Uri fromUri = _fromUriString.ToUri("The from URI was invalid");
			Uri toUri = _toUriString.ToUri("The to URI was invalid");

			IInboundTransport fromTransport = Program.Transports.GetTransport(fromUri);
			IOutboundTransport toTransport = Program.Transports.GetTransport(toUri);

			ITextBlock text = new TextBlock()
				.BeginBlock("Move messages from " + fromUri + " to " + toUri, "");

			int moveCount = 0;
			for (int i = 0; i < _count; i++)
			{
				fromTransport.Receive(receiveContext =>
					{
						return context =>
							{
								var moveContext = new MoveMessageSendContext(context);

								toTransport.Send(moveContext);

								text.BodyFormat("Message-Id: {0}", context.MessageId);

								moveCount++;
							};
					}, TimeSpan.Zero);
			}

			_log.Info(text);
			_log.InfoFormat("{0} message{1} moved from {2} to {3}", moveCount, moveCount == 1 ? "" : "s", fromUri, toUri);

			return true;
		}
开发者ID:Noctris,项目名称:MassTransit,代码行数:34,代码来源:MoveCommand.cs

示例4: e_23_Col3_ct_dtMethod

 private static UIElement e_23_Col3_ct_dtMethod(UIElement parent)
 {
     // e_25 element
     StackPanel e_25 = new StackPanel();
     e_25.Parent = parent;
     e_25.Name = "e_25";
     // e_26 element
     TextBlock e_26 = new TextBlock();
     e_25.Children.Add(e_26);
     e_26.Name = "e_26";
     Binding binding_e_26_Text = new Binding("Text");
     e_26.SetBinding(TextBlock.TextProperty, binding_e_26_Text);
     // e_27 element
     StackPanel e_27 = new StackPanel();
     e_25.Children.Add(e_27);
     e_27.Name = "e_27";
     e_27.Orientation = Orientation.Horizontal;
     // e_28 element
     TextBlock e_28 = new TextBlock();
     e_27.Children.Add(e_28);
     e_28.Name = "e_28";
     Binding binding_e_28_Text = new Binding("Boolean");
     e_28.SetBinding(TextBlock.TextProperty, binding_e_28_Text);
     // e_29 element
     TextBlock e_29 = new TextBlock();
     e_27.Children.Add(e_29);
     e_29.Name = "e_29";
     Binding binding_e_29_Text = new Binding("Number");
     e_29.SetBinding(TextBlock.TextProperty, binding_e_29_Text);
     return e_25;
 }
开发者ID:Mike-EEE,项目名称:UI_Examples,代码行数:31,代码来源:BasicUI.xaml.cs

示例5: MainPage

        // 构造函数
        public MainPage()
        {
            InitializeComponent();

            app.str_Uri = null;

            #region 计时
            txtb_Time = new TextBlock();
            Canvas.SetLeft(txtb_Time, 350);
            Canvas.SetTop(txtb_Time, 0);
            Carrier.Children.Add(txtb_Time);
            this.txtb_Time.Text = count.ToString();//开始时为00:00:00
            this.timer.Tick += Timer_Tick;//时间控件timer,事件Tick,类似线程
            this.timer.Interval = TimeSpan.FromMilliseconds(100);//每100毫秒变化一次
            StartTime = DateTime.UtcNow;
            this.timer.Start();//控件timer开始计时,类似线程开始
            #endregion

            #region 判断是否游戏结束
            dispatcherTimerChecked = new DispatcherTimer();
            dispatcherTimerChecked.Tick += new EventHandler(dispatcherTimerChecked_Tick);
            dispatcherTimerChecked.Interval = TimeSpan.FromMilliseconds(50);
            dispatcherTimerChecked.Start();
            #endregion
        }
开发者ID:GhostSoar,项目名称:JigsawPuzzle,代码行数:26,代码来源:MainPage.xaml.cs

示例6: CreateAndShowMainWindow

    private void CreateAndShowMainWindow() {
        // Create the application's main window
        mainWindow = new Window();

        // Create a canvas sized to fill the window
        canvas = new Canvas();
        canvas.Background = Brushes.LightSteelBlue;

        // Add a "Hello World!" text element to the Canvas
        TextBlock txt = new TextBlock();
        txt.FontSize = 30;
        txt.TextContent = "Hello World!";
        Canvas.SetTop(txt, 100);
        Canvas.SetLeft(txt, 100);
        canvas.Children.Add(txt);

        Button btn = new Button();
        btn.FontSize = 30;
        btn.Content = "Run Script";
        btn.Click += new RoutedEventHandler(btn_Click);
        Canvas.SetTop(btn, 20);
        Canvas.SetLeft(btn, 100);
        canvas.Children.Add(btn);

        mainWindow.Content = canvas;
        mainWindow.Show();
    }
开发者ID:xxjeng,项目名称:nuxleus,代码行数:27,代码来源:EmbedFinal.cs

示例7: e_28_Col3_ct_dtMethod

 private static UIElement e_28_Col3_ct_dtMethod(UIElement parent)
 {
     // e_30 element
     StackPanel e_30 = new StackPanel();
     e_30.Parent = parent;
     e_30.Name = "e_30";
     // e_31 element
     TextBlock e_31 = new TextBlock();
     e_30.Children.Add(e_31);
     e_31.Name = "e_31";
     Binding binding_e_31_Text = new Binding("Text");
     e_31.SetBinding(TextBlock.TextProperty, binding_e_31_Text);
     // e_32 element
     StackPanel e_32 = new StackPanel();
     e_30.Children.Add(e_32);
     e_32.Name = "e_32";
     e_32.Orientation = Orientation.Horizontal;
     // e_33 element
     TextBlock e_33 = new TextBlock();
     e_32.Children.Add(e_33);
     e_33.Name = "e_33";
     Binding binding_e_33_Text = new Binding("Boolean");
     e_33.SetBinding(TextBlock.TextProperty, binding_e_33_Text);
     // e_34 element
     TextBlock e_34 = new TextBlock();
     e_32.Children.Add(e_34);
     e_34.Name = "e_34";
     Binding binding_e_34_Text = new Binding("Number");
     e_34.SetBinding(TextBlock.TextProperty, binding_e_34_Text);
     return e_30;
 }
开发者ID:EmptyKeys,项目名称:UI_Examples,代码行数:31,代码来源:BasicUI.xaml.cs

示例8: OnDisconnect

        public void OnDisconnect()
        {
            Deployment.Current.Dispatcher.BeginInvoke(() =>
            {
            Progress.Visibility = Visibility.Collapsed;
            if (_connection == null || !_connection._isConnectedFirstTime)
            {
            ContentPanel.Children.Clear();
            TextBlock textBlock = new TextBlock()
            {
            Text = "Connection failed",
            Margin = new Thickness(10, 2, 10, 2),
            FontSize = 20
            };
            Button reconnect = new Button() { Content = "Reconnect" };
            reconnect.BorderThickness = new Thickness(0);
            reconnect.Foreground = new SolidColorBrush(Colors.Black);
            reconnect.Background = new SolidColorBrush(Colors.LightGray);
            reconnect.Click += new RoutedEventHandler(Reconnect_Click);
            ContentPanel.Children.Add(textBlock);
            ContentPanel.Children.Add(reconnect);

            }
            });
        }
开发者ID:kisorbiswal,项目名称:accounter,代码行数:25,代码来源:MainPage.xaml.cs

示例9: ShowBody

        private void ShowBody(Note note)
        {
            this.body.Children.Clear();
            foreach (NoteDetail dett in note.Body)
            {
                if (!string.IsNullOrEmpty(dett.Text))
                {
                    TextBlock block2 = new TextBlock
                    {
                        TextWrapping = TextWrapping.Wrap,
                        FontSize = 40,
                        Foreground = new SolidColorBrush(Colors.Black),
                        Text = dett.Text
                    };
                    TextBlock block = block2;
                    this.body.Children.Add(block);
                }
                else if ((dett.ListPageDraw != null) && (dett.ListPageDraw.Count > 0))
                {
                    ShowDrawingsControl drawings2 = new ShowDrawingsControl
                    {
                        HorizontalAlignment = HorizontalAlignment.Stretch,
                        DataSource = dett.ListPageDraw
                    };
                    ShowDrawingsControl drawings = drawings2;
                    this.body.Children.Add(drawings);
                }
            }

        }
开发者ID:peepo3663,项目名称:WindowsPhone8,代码行数:30,代码来源:NotePreview.xaml.cs

示例10: GetGroupTopicCompleted

 void GetGroupTopicCompleted(object s, DoubanSearchCompletedEventArgs args)
 {
     App.GroupTopicViewModel.GetGroupTopicCompleted -= GetGroupTopicCompleted;
     Deployment.Current.Dispatcher.BeginInvoke(() =>
     {
         base.SetProgressIndicator(false);
         if (args.IsSuccess)
         {
             contentContainer.Visibility = Visibility.Visible;
             contentContainer.IsEnabled = true;
             foreach (var content in App.GroupTopicViewModel.TopicContentList)
             {
                 TextBlock tb = new TextBlock();
                 //tb.Width = 445;
                 tb.TextWrapping = TextWrapping.Wrap;
                 tb.Foreground = new SolidColorBrush(Colors.Black);
                 tb.FontSize = (double)App.Current.Resources["PhoneFontSizeMedium"];
                 tb.Text = content;
                 spContent.Children.Add(tb);
             }
             contentContainer.ScrollToVerticalOffset(0);
         }
         else
         {
             ToastPrompt toast = new ToastPrompt();
             toast.Message = args.Message;
             toast.Show();
         }
     }
     );
 }
开发者ID:Hcs66,项目名称:WinDou,代码行数:31,代码来源:GroupTopicView.xaml.cs

示例11: LoadNations

        void LoadNations()
        {
            int LanguageIndex = edtContentLang.SelectedIndex;
            spNations.Children.Clear();
            nations = MythDB.Instance.Database.Nations.ToList();
            checkBoxes = new List<CheckBox>();
            foreach (Nation n in nations)
            {
                StackPanel sp = new StackPanel();
                sp.Orientation = System.Windows.Controls.Orientation.Horizontal;
                sp.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
                sp.VerticalAlignment = System.Windows.VerticalAlignment.Center;

                TextBlock tb = new TextBlock();
                tb.Text = "[" + n.I18nNations[LanguageIndex].ShortName + "] " + n.I18nNations[LanguageIndex].Name;
                tb.FontSize = 20;
                tb.Width = 350;
                tb.VerticalAlignment = System.Windows.VerticalAlignment.Center;
                sp.Children.Add(tb);

                CheckBox cb = new CheckBox();
                cb.IsChecked = n.IsActive;
                cb.VerticalAlignment = System.Windows.VerticalAlignment.Center;
                sp.Children.Add(cb);
                checkBoxes.Add(cb);

                spNations.Children.Add(sp);
            }
        }
开发者ID:bashlykevich,项目名称:MythologyWP,代码行数:29,代码来源:SettingsPage.xaml.cs

示例12: SetupZoomableText

        public static void SetupZoomableText(TextBlock zoomableText)
        {
            zoomableText.Text = @"<<MainPage.cs>>
            namespace SilverlightRunSample.VM
            {
            public class MainPage : SilverlightRun.ViewModel.ColdViewModel<MainPage>
            {
            [SilverlightRun.Tombstoning.SurvivesTombstoning]
            public string Word1 { get; set; }

            [SilverlightRun.Tombstoning.SurvivesRestart]
            public string Word2 { get; set; }

            public MainPage()
            {
            }
            }
            }

            <<ViewModelCenter.cs>>
            using SilverlightRun.DI;

            namespace SilverlightRunSample.VM
            {
            public class ViewModelCenter : SilverlightRun.PhoneSpecific.PhoneTypeCenter
            {
            protected override void ContainerSetup(GenericSimpleContainer container)
            {
            container.DeclareSingleton<VM.MainPage, VM.MainPage>();
            }
            }
            }
            ";
        }
开发者ID:halllo,项目名称:SilverlightRun,代码行数:34,代码来源:ViewHelper.cs

示例13: OnApplyTemplate

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            // We are ready to retreive controls from the template
            this.listBox = this.GetTemplateChild("listBox") as ListBox;
            listBox.ItemsSource = ItemSource;

            this.titleTextBlock = this.GetTemplateChild("DialogTitle") as TextBlock;
            // Assign the values
            this.ItemSource = itemSource;
            this.Title = title;
            if (this.ItemSource != null)
            {
                SelectedIndex = selectedIndex;

                if (listBox.SelectedItem != null)
                    listBox.SetVerticalScrollOffset(SelectedIndex);
            }
            listBox.Opacity = 0;
            // Hook up into listbox's events
            this.listBox.SelectionChanged += new SelectionChangedEventHandler(listBox_SelectionChanged);
            this.listBox.Loaded += new RoutedEventHandler(listBox_Loaded);
            this.listBox.SelectionMode = SelectionMode.Multiple;
        }
开发者ID:KhalidElSayed,项目名称:ocrapiservice,代码行数:25,代码来源:PickerBoxDialog.cs

示例14: AllRunsPage_Loaded

        // Load data from footfall manager
        private void AllRunsPage_Loaded(object sender, RoutedEventArgs e)
        {
            AllPastRuns.Children.Clear();

            foreach (Activity activity in footfallManager.previousRuns)
            {

                StackPanel mainSP = new StackPanel() { Tag = activity, Orientation = System.Windows.Controls.Orientation.Horizontal, Margin = new Thickness(0, 0, 0, 12) };
                mainSP.Tap += new EventHandler<GestureEventArgs>(ViewRun_Tap);

                Image i = new Image() { Height = 99, Source = (ImageSource)(new ImageSourceConverter().ConvertFromString("MapPics/Map1.png")) };

                StackPanel sp = new StackPanel() { Width = 296, Margin = new Thickness(0, 0, 0, 0) };

                TextBlock title = new TextBlock() { Text = activity.title, Style = (Style)App.Current.Resources["PhoneTextLargeStyle"], TextWrapping = TextWrapping.NoWrap };
                TextBlock lineTwo = new TextBlock() { Text = activity.GetLineTwoText(), Style = (Style)App.Current.Resources["PhoneTextNormalStyle"], TextWrapping = TextWrapping.NoWrap };
                TextBlock lineThree = new TextBlock() { Text = activity.GetLineThreeText(), Style = (Style)App.Current.Resources["PhoneTextNormalStyle"], TextWrapping = TextWrapping.NoWrap };

                sp.Children.Add(title);
                sp.Children.Add(lineTwo);
                sp.Children.Add(lineThree);

                mainSP.Children.Add(i);
                mainSP.Children.Add(sp);

                AllPastRuns.Children.Add(mainSP);

            }
        }
开发者ID:jasonbw,项目名称:Runner,代码行数:30,代码来源:AllRunsPage.xaml.cs

示例15: InitApartments

        private async void InitApartments()
        {
            var apartments = await App.MobileService.GetTable<Apartment>().Where(a => a.Published == true).ToListAsync();
            listApartments.ItemsSource = apartments;

            mapApartments.Layers.Clear();
            MapLayer layer = new MapLayer();
            foreach (Apartment apartment in apartments)
            {
                MapOverlay overlay = new MapOverlay();
                overlay.GeoCoordinate = new GeoCoordinate(apartment.Latitude, apartment.Longitude);
                overlay.PositionOrigin = new Point(0, 0);
                Grid grid = new Grid { Height = 40, Width = 25, Background = new SolidColorBrush(Colors.Red) };
                TextBlock text = new TextBlock { Text = apartment.Bedrooms.ToString(), VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center };
                grid.Children.Add(text);
                overlay.Content = grid;
                grid.Tap += (s, e) =>
                {
                    MessageBox.Show(
                        "Address: " + apartment.Address + Environment.NewLine + apartment.Bedrooms + " bedrooms",
                        "Apartment", MessageBoxButton.OK);
                    mapApartments.SetView(overlay.GeoCoordinate, 15, MapAnimationKind.Parabolic);
                };
                layer.Add(overlay);
            }
            mapApartments.Layers.Add(layer);
        }
开发者ID:NoamSheffer,项目名称:rentahome,代码行数:27,代码来源:MainPage.xaml.cs


注:本文中的TextBlock类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。