Advertisement
Guest User

Untitled

a guest
Sep 29th, 2016
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. using System.Windows.Controls;
  2.  
  3. namespace TestControls.Controls
  4. {
  5. public class МyTextBox : TextBox
  6. {
  7.  
  8. public МyTextBox()
  9. {
  10. Text = "MyTextBox";
  11. }
  12. }
  13. }
  14.  
  15. <UserControl x:Class="TestControls.Controls.MyText"
  16. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  17. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  18. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  19. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  20. mc:Ignorable="d"
  21. d:DesignHeight="300" d:DesignWidth="400">
  22.  
  23. <Grid x:Name="LayoutRoot" Background="White">
  24. <TextBlock Name="Text"/>
  25. </Grid>
  26. </UserControl>
  27.  
  28. using System.Windows.Controls;
  29.  
  30. namespace TestControls.Controls
  31. {
  32. public partial class MyText : UserControl
  33. {
  34. public MyText()
  35. {
  36. InitializeComponent();
  37. Text.Text = "MyTextControl";
  38. }
  39. }
  40. }
  41.  
  42. <UserControl x:Class="TestControlsApplication.MainPage"
  43. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  44. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  45. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  46. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  47. mc:Ignorable="d"
  48. d:DesignHeight="300" d:DesignWidth="400">
  49.  
  50. <Grid x:Name="LayoutRoot" Background="White">
  51. <StackPanel Name="Panel"/>
  52. </Grid>
  53. </UserControl>
  54.  
  55. using System.Windows.Controls;
  56. using TestControls.Controls;
  57.  
  58. namespace TestControlsApplication
  59. {
  60. public partial class MainPage : UserControl
  61. {
  62. public MainPage()
  63. {
  64. InitializeComponent();
  65.  
  66. for (int i = 0; i < 1000; i++)
  67. {
  68. MyText t = new MyText();
  69. МyTextBox tb = new МyTextBox();
  70. Panel.Children.Add(t);
  71. Panel.Children.Add(tb);
  72. }
  73. }
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement