本文整理汇总了C#中Windows.UI.Xaml.Controls.TextBlock类的典型用法代码示例。如果您正苦于以下问题:C# TextBlock类的具体用法?C# TextBlock怎么用?C# TextBlock使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextBlock类属于Windows.UI.Xaml.Controls命名空间,在下文中一共展示了TextBlock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadGDChoVay
private async void LoadGDChoVay()
{
var business = new BusGiaoDich();
var listChoVay = await business.LoadGiaoDichByLoaiGD(_idChoVay);
if (listChoVay.Count == 0)
{
var status = new TextBlock()
{
FontSize = 30,
FontStyle = FontStyle.Italic,
Foreground = new SolidColorBrush(Colors.DimGray),
TextWrapping = TextWrapping.Wrap,
Text = "Hiện chưa có giao dịch nào trong sổ cho vay"
};
ChoVayPanel.Children.Add(status);
}
else
{
ChoVayPanel.Children.Clear();
foreach (var giaoDich in listChoVay)
{
var giaoDichItem = new ViewData(giaoDich) { Margin = new Thickness(10) };
ChoVayPanel.Children.Add(giaoDichItem);
}
}
}
示例2: DisplayOrientation
/// <summary>
/// Helper method to display the device orientation in the specified text box.
/// </summary>
/// <param name="tb">
/// The text box receiving the orientation value.
/// </param>
/// <param name="orientation">
/// The orientation value.
/// </param>
private void DisplayOrientation(TextBlock tb, SimpleOrientation orientation)
{
switch (orientation)
{
case SimpleOrientation.NotRotated:
tb.Text = "Not Rotated";
break;
case SimpleOrientation.Rotated90DegreesCounterclockwise:
tb.Text = "Rotated 90 Degrees Counterclockwise";
break;
case SimpleOrientation.Rotated180DegreesCounterclockwise:
tb.Text = "Rotated 180 Degrees Counterclockwise";
break;
case SimpleOrientation.Rotated270DegreesCounterclockwise:
tb.Text = "Rotated 270 Degrees Counterclockwise";
break;
case SimpleOrientation.Faceup:
tb.Text = "Faceup";
break;
case SimpleOrientation.Facedown:
tb.Text = "Facedown";
break;
default:
tb.Text = "Unknown orientation";
break;
}
}
示例3: InitDigits
private void InitDigits()
{
var converter = new ObjectSizeConverter();
var offset = converter.Convert(125);
for (int i = 1; i <= 12; ++i)
{
TextBlock tb = new TextBlock();
tb.Text = i.ToString();
tb.TextAlignment = TextAlignment.Center;
tb.RenderTransformOrigin = new Point(1, 1);
tb.Foreground = new SolidColorBrush(Colors.White);
tb.FontSize = converter.Convert(8);
tb.RenderTransform = new ScaleTransform {ScaleX = 2, ScaleY = 2};
double r = converter.Convert(85);
double angle = Math.PI*i*30.0/180.0;
double x = Math.Sin(angle)*r + offset, y = -Math.Cos(angle)*r + offset;
Canvas.SetLeft(tb, x);
Canvas.SetTop(tb, y);
_markersCanvas.Children.Add(tb);
}
}
示例4: OutputAndRemoveDataPoint
private static int OutputAndRemoveDataPoint(TextBlock target, string toOutput)
{
var pattern = @"(¤(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\¤])*¤(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)".Replace('¤', '"');
var matches = Regex.Matches(toOutput, pattern);
if (Regex.IsMatch(matches[0].Value, @"^¤".Replace('¤', '"')))
{
if (Regex.IsMatch(matches[0].Value, ":$"))
{
// key
target.OutputBold(matches[0].Value.Replace('\"', '\0') + "\t");
}
else
{
// string
target.OutputWithFormat(matches[0].Value + Environment.NewLine, fontColor: Colors.DarkGreen);
}
}
else if (Regex.IsMatch(matches[0].Value, "true|false"))
{
// boolean
target.OutputWithFormat(matches[0].Value.Replace('\"', '\0') + Environment.NewLine, fontColor: Colors.DarkBlue);
}
else if (Regex.IsMatch(matches[0].Value, "null"))
{
// null
target.OutputWithFormat(matches[0].Value.Replace('\"', '\0') + Environment.NewLine, fontColor: Colors.DarkBlue);
}
else
{
// number
target.OutputWithFormat(matches[0].Value.Replace('\"', '\0') + Environment.NewLine, fontColor: Colors.DarkCyan);
}
return matches[0].Length;
}
示例5: back_Click
//ApplicationDataContainer.mytest
private void back_Click(object sender, RoutedEventArgs e)
{
TextBlock d = new TextBlock();
d.Text = "hello";
if(Frame.CanGoBack)
Frame.GoBack();
}
示例6: InitializeComponent
public void InitializeComponent()
{
if (_contentLoaded)
return;
_contentLoaded = true;
Application.LoadComponent(this, new System.Uri("ms-appx:///Tweet.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
pageRoot = (Mu_genotype1.Common.LayoutAwarePage)this.FindName("pageRoot");
primaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("primaryColumn");
titlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("titlePanel");
itemListScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer");
itemListScrollViewer2 = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer2");
PeerTweets = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("PeerTweets");
itemListView2 = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView2");
TweetBox = (Windows.UI.Xaml.Controls.TextBox)this.FindName("TweetBox");
TweetIt = (Windows.UI.Xaml.Controls.Button)this.FindName("TweetIt");
PinPanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("PinPanel");
itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView");
PinTb = (Windows.UI.Xaml.Controls.TextBox)this.FindName("PinTb");
VerifyPinButton = (Windows.UI.Xaml.Controls.Button)this.FindName("VerifyPinButton");
backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
pageSubtitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageSubtitle");
FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
FullScreenPortrait_Detail = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait_Detail");
Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
Snapped_Detail = (Windows.UI.Xaml.VisualState)this.FindName("Snapped_Detail");
TwitterConnectBtn = (Windows.UI.Xaml.Controls.Button)this.FindName("TwitterConnectBtn");
RefreshButton = (Windows.UI.Xaml.Controls.Button)this.FindName("RefreshButton");
}
示例7: HighlightRanges
public void HighlightRanges(TextBlock tb, String TextContent, IReadOnlyList<TextSegment> ranges)
{
int currentPosition = 0;
foreach (var range in ranges)
{
// Add the next chunk of non-range text
if (range.StartPosition > currentPosition)
{
int length = (int)range.StartPosition - currentPosition;
var subString = TextContent.Substring(currentPosition, length);
tb.Inlines.Add(new Run() { Text = subString });
currentPosition += length;
}
// Add the next range
var boldString = TextContent.Substring((int)range.StartPosition, (int)range.Length);
tb.Inlines.Add(new Run() { Text = boldString, FontWeight = FontWeights.Bold });
currentPosition += (int)range.Length;
}
// Add the text after the last matching segment
if (currentPosition < TextContent.Length)
{
var subString = TextContent.Substring(currentPosition);
tb.Inlines.Add(new Run() { Text = subString });
}
tb.Inlines.Add(new Run() { Text = "\r\n" });
}
示例8: init
void init()
{
Width = 1600.0;
Height = 900.0;
_currentHeight = 900.0;
_contentpanel = new StackPanel() { Orientation = Orientation.Vertical };
_contentpanel.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Left;
_contentpanel.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top;
_contentpanel.RenderTransform = new CompositeTransform() { TranslateX = 320.0 };
_contentpanel.Width = 560.0;
_contentpanel.SizeChanged += _contentpanel_SizeChanged;
Children.Add(_contentpanel);
Grid header = new Grid() { Width = 100.0, Height = 250.0 };
Grid footer = new Grid() { Width = 100.0, Height = 250.0 };
Grid separation = new Grid() { Width = 100.0, Height = 78.0 };
_titleblock = new TextBlock() { TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap, FontSize = 26, FontWeight = Windows.UI.Text.FontWeights.Light };
_titleblock.LayoutUpdated += _titleblock_LayoutUpdated;
_contentblock = new TextBlock() { TextWrapping = Windows.UI.Xaml.TextWrapping.Wrap, FontSize = 33, FontWeight = Windows.UI.Text.FontWeights.Light, FontStyle = Windows.UI.Text.FontStyle.Italic };
_contentblock.LayoutUpdated += _contentblock_LayoutUpdated;
//childrens of content
_contentpanel.Children.Add(header);
_contentpanel.Children.Add(_contentblock);
_contentpanel.Children.Add(separation);
_contentpanel.Children.Add(_titleblock);
_contentpanel.Children.Add(footer);
}
示例9: OnApplyTemplate
/// <summary>
/// Builds the visual tree for the ColorPicker control when the template is applied.
/// </summary>
protected override void OnApplyTemplate()
{
base.OnApplyTemplate();
m_rootElement = GetTemplateChild("RootElement") as Panel;
m_hueMonitor = GetTemplateChild("HueMonitor") as Rectangle;
m_sampleSelector = GetTemplateChild("SampleSelector") as Canvas;
m_hueSelector = GetTemplateChild("HueSelector") as Canvas;
m_selectedColorView = GetTemplateChild("SelectedColorView") as Rectangle;
m_colorSample = GetTemplateChild("ColorSample") as Rectangle;
m_hexValue = GetTemplateChild("HexValue") as TextBlock;
m_rootElement.RenderTransform = m_scale = new ScaleTransform();
m_hueMonitor.PointerPressed += m_hueMonitor_PointerPressed;
m_hueMonitor.PointerReleased += m_hueMonitor_PointerReleased;
m_hueMonitor.PointerMoved += m_hueMonitor_PointerMoved;
m_colorSample.PointerPressed += m_colorSample_PointerPressed;
m_colorSample.PointerReleased += m_colorSample_PointerReleased;
m_colorSample.PointerMoved += m_colorSample_PointerMoved;
m_sampleX = m_colorSample.Width;
m_sampleY = 0;
m_huePos = 0;
UpdateVisuals();
}
示例10: GetTextBlockControl
private void GetTextBlockControl()
{
if (this.favoriteIcon == null)
{
this.favoriteIcon = this.GetTemplateChild("FavoriteIcon") as TextBlock;
}
}
示例11: Populate
public void Populate(IEnumerable<ILayer> layers)
{
Children.Clear();
foreach (var layer in layers)
{
if (string.IsNullOrEmpty(layer.Attribution.Text)) continue;
var attribution = new StackPanel { Orientation = Orientation.Horizontal };
var textBlock = new TextBlock();
if (string.IsNullOrEmpty(layer.Attribution.Url))
{
textBlock.Text = layer.Attribution.Text;
}
else
{
var hyperlink = new Hyperlink();
hyperlink.Inlines.Add(new Run{ Text = layer.Attribution.Text});
hyperlink.NavigateUri = new Uri(layer.Attribution.Url);
textBlock.Inlines.Add(hyperlink);
textBlock.Padding = new Thickness(6, 2, 6, 2);
attribution.Children.Add(textBlock);
}
Children.Add(attribution);
}
}
示例12: ItemContainerGenerator_ItemsChanged
private void ItemContainerGenerator_ItemsChanged(object sender, ItemsChangedEventArgs e)
{
if (e.Action == 1)
{
Position item = lstPositions.Items.Last() as Position;
layers = new MapLayer();
image = new BitmapImage();
image.UriSource = (new Uri(SelectedFriend.Picture, UriKind.Absolute));
grid = new Grid();
grid.DataContext = item;
grid.RightTapped += grid_RightTapped;
textBlock = new TextBlock();
textBlock.Text = item.Counter.ToString();
textBlock.VerticalAlignment = VerticalAlignment.Bottom;
textBlock.HorizontalAlignment = HorizontalAlignment.Center;
brush = new ImageBrush();
brush.ImageSource = image;
ellipse = new Ellipse();
ellipse.Height = 100;
ellipse.Width = 100;
ellipse.Fill = brush;
grid.Children.Add(ellipse);
grid.Children.Add(textBlock);
layers.Children.Add(grid);
MapLayer.SetPosition(grid, new Location(item.Latitude, item.Longitude));
myMap.Children.Add(layers);
}
}
示例13: ColorList1Page
public ColorList1Page() {
this.InitializeComponent();
IEnumerable<PropertyInfo> properties = typeof(Colors).GetTypeInfo().DeclaredProperties;
foreach (PropertyInfo property in properties) {
Color clr = (Color)property.GetValue(null);
StackPanel vertStackPanel = new StackPanel { VerticalAlignment = VerticalAlignment.Center };
TextBlock txtblkName = new TextBlock {
Text = property.Name,
FontSize = 24 };
TextBlock txtblkRgb = new TextBlock {
Text = String.Format("{0:X2}-{1:X2}-{2:X2}-{3:X2}", clr.A, clr.R, clr.G, clr.B),
FontSize = 18
};
vertStackPanel.Children.Add(txtblkName);
vertStackPanel.Children.Add(txtblkRgb);
StackPanel horzStackPanel = new StackPanel { Orientation = Orientation.Horizontal };
Rectangle rectangle = new Rectangle {
Width = 72,
Height = 72,
Fill = new SolidColorBrush(clr),
Margin = new Thickness(6)
};
horzStackPanel.Children.Add(rectangle);
horzStackPanel.Children.Add(vertStackPanel);
stackPanel.Children.Add(horzStackPanel);
}
}
示例14: GetTextBlockControl
private void GetTextBlockControl()
{
if (this.notifyBlock == null)
{
this.notifyBlock = this.GetTemplateChild("tb_Notify") as TextBlock;
}
}
示例15: InitializeComponent
public void InitializeComponent()
{
if (_contentLoaded)
return;
_contentLoaded = true;
Application.LoadComponent(this, new System.Uri("ms-appx:///ArtistDetails.xaml"), Windows.UI.Xaml.Controls.Primitives.ComponentResourceLocation.Application);
pageRoot = (Mu_genotype1.Common.LayoutAwarePage)this.FindName("pageRoot");
primaryColumn = (Windows.UI.Xaml.Controls.ColumnDefinition)this.FindName("primaryColumn");
titlePanel = (Windows.UI.Xaml.Controls.Grid)this.FindName("titlePanel");
itemListScrollViewer = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemListScrollViewer");
itemDetail = (Windows.UI.Xaml.Controls.ScrollViewer)this.FindName("itemDetail");
itemDetailGrid = (Windows.UI.Xaml.Controls.Grid)this.FindName("itemDetailGrid");
itemDetailTitlePanel = (Windows.UI.Xaml.Controls.StackPanel)this.FindName("itemDetailTitlePanel");
ArtistContentTb = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("ArtistContentTb");
itemTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("itemTitle");
itemSubtitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("itemSubtitle");
itemListView = (Windows.UI.Xaml.Controls.ListView)this.FindName("itemListView");
backButton = (Windows.UI.Xaml.Controls.Button)this.FindName("backButton");
pageTitle = (Windows.UI.Xaml.Controls.TextBlock)this.FindName("pageTitle");
FullScreenLandscape = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenLandscape");
Filled = (Windows.UI.Xaml.VisualState)this.FindName("Filled");
FullScreenPortrait = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait");
FullScreenPortrait_Detail = (Windows.UI.Xaml.VisualState)this.FindName("FullScreenPortrait_Detail");
Snapped = (Windows.UI.Xaml.VisualState)this.FindName("Snapped");
Snapped_Detail = (Windows.UI.Xaml.VisualState)this.FindName("Snapped_Detail");
}