Created
May 28, 2015 14:59
-
-
Save Keyros/8154d407abefe1978ccf to your computer and use it in GitHub Desktop.
Пример 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Windows.Controls; | |
namespace TerstWpfApp | |
{ | |
/// <summary> | |
/// Логика взаимодействия для MyUserControl.xaml | |
/// </summary> | |
public partial class MyUserControl : UserControl | |
{ | |
public MyUserControl() | |
{ | |
InitializeComponent(); | |
} | |
public double TextBlockWidth | |
{ | |
get { return TextBox.Width; } | |
set { TextBox.Width = value; } | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<UserControl x:Class="TerstWpfApp.MyUserControl" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
mc:Ignorable="d" | |
d:DesignHeight="300" d:DesignWidth="300"> | |
<Grid> | |
<TextBox Name="TextBox"></TextBox> | |
</Grid> | |
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Window x:Class="TerstWpfApp.MainWindow" | |
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
xmlns:terstWpfApp="clr-namespace:TerstWpfApp" | |
Title="MainWindow" | |
Height="350" | |
Width="525"> | |
<Grid> | |
<terstWpfApp:MyUserControl Name="MyUserControl"> | |
</terstWpfApp:MyUserControl> | |
</Grid> | |
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Windows; | |
namespace TerstWpfApp | |
{ | |
/// <summary> | |
/// Логика взаимодействия для MainWindow.xaml | |
/// </summary> | |
public partial class MainWindow : Window | |
{ | |
public MainWindow() | |
{ | |
InitializeComponent(); | |
} | |
public void Tmp() | |
{ | |
this.MyUserControl.TextBlockWidth = 1234.0; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment