public static Windows.UI.Xaml.Documents.Run Binding( this Windows.UI.Xaml.Documents.Run element, string property, string propertyPath ) { propertyPath = propertyPath.Replace("].[", "]["); if (property == "Text") { var templateString = "<Run xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" Text=\"{{Binding {0}}}\" />"; return((Windows.UI.Xaml.Documents.Run)Windows.UI.Xaml.Markup.XamlReader.Load(templateString.InvariantCultureFormat(propertyPath))); } else { var path = new PropertyPath(propertyPath); var binding = new Windows.UI.Xaml.Data.Binding { Path = path }; var dependencyProperty = GetDependencyProperty(element, property); BindingOperations.SetBinding(element, dependencyProperty, binding); return(element); } }
private void Page_Loaded(object sender, RoutedEventArgs e) { BIP39 bip39 = new BIP39(); var privateKey = App.Store.State.wallet.PrivateKey; var pvkBin = Base58Encoding.DecodePrivateKey(privateKey); var pkv = ByteArrayToString(pvkBin); var mnu = bip39.EntropyToMnemonic(pkv, BIP39Wordlist.English); var words = mnu.Trim().Split(' '); // create grid for (var i = 0; i < words.Length; i++) { var tblock = new TextBlock(); var run1 = new Windows.UI.Xaml.Documents.Run { Text = $"{i + 1} " }; run1.FontSize = 12; tblock.Inlines.Add(run1); var run2 = new Windows.UI.Xaml.Documents.Run { Text = $"{words[i]}" }; run2.FontSize = 24; run2.FontWeight = FontWeights.Bold; tblock.Inlines.Add(run2); tblock.Padding = new Thickness(5); if (i < 12) { var rd = new RowDefinition { Height = new GridLength((double)42) }; wordsGrid.RowDefinitions.Add(rd); } wordsGrid.Children.Add(tblock); Grid.SetRow(tblock, i % 12); Grid.SetColumn(tblock, i / 12); } }
private void Page_Loaded(object sender, RoutedEventArgs e) { tboxes = new List <TextBox>(); // create grid for (var i = 0; i < 24; i++) { var tblock = new TextBlock(); var run1 = new Windows.UI.Xaml.Documents.Run { Text = $"{i + 1} " }; run1.FontSize = 12; tblock.Inlines.Add(run1); tblock.Padding = new Thickness(5); if (i < 12) { var rd = new RowDefinition { Height = new GridLength((double)42) }; wordsGrid.RowDefinitions.Add(rd); } wordsGrid.Children.Add(tblock); Grid.SetRow(tblock, i % 12); Grid.SetColumn(tblock, (i / 12) * 2); var tbox = new TextBox { Width = 120 }; tbox.Padding = new Thickness(5); wordsGrid.Children.Add(tbox); Grid.SetRow(tbox, i % 12); Grid.SetColumn(tbox, (i / 12) * 2 + 1); tboxes.Add(tbox); } }
public MainPage() { this.InitializeComponent(); var grid = new Grid() { Background = new SolidColorBrush(Windows.UI.Colors.White) }; var textBk = new TextBlock() { FontSize = 50 }; var runText = new Windows.UI.Xaml.Documents.Run() { Text = "Hello, world!" }; textBk.Inlines.Add(runText); grid.Children.Add(textBk); this.Content = grid; }