プロジェクトは、ここにレコードの下で、書き換え制御が発生することがあります。
1 <ウインドウは、x:クラス= " WpfApp6.MainWindow " 2つ のxmlns = " http://schemas.microsoft.com/winfx/2006/xaml/presentation " 3つ のxmlns:X = " http://schemas.microsoft.com/をWinFX / 2006 / XAML " 4つ のxmlns:D = " http://schemas.microsoft.com/expression/blend/2008 " 5つ のxmlns:MC = " http://schemas.openxmlformats.org/markup-compatibility/2006 " 6つ のxmlns:ローカル= " CLR名前空間:WpfApp6 " 7 MC:無視可能= "D " 8 タイトル= " メインウィンドウ"高さ= " 157 "幅= " 287 " > 9 <Window.Resources> 10 <スタイルTargetTypeに= " ローカル:CustomTextBox " > 11 <setterプロパティ= " テンプレート" > 12 <Setter.Value> 13 <たControlTemplate> 14 <グリッド> 15 <Grid.ColumnDefinitions> 16 <ColumnDefinition /> 17 <ColumnDefinition幅= " オート" /> 18 </Grid.ColumnDefinitions> 19 <テキストボックスVerticalContentAlignment = " センター" 20 パディング= " 5 " 21 テキスト= " {バインディングRelativeSource = {RelativeSource TemplatedParent}、PATH =テキスト} " /> 22 <ボタンのx:名前= " btnclear" Grid.Column = " 1 "幅= " 30 "マージン= " 3 "コンテンツ= " 清空" /> 23 </グリッド> 24 </のControlTemplate> 25 </Setter.Value> 26 </セッター> 27 </スタイル> 28 </Window.Resources> 29 <グリッド> 30 <StackPanelの> 31 <ローカル:CustomTextBoxテキスト= "852 " /> 32 </ StackPanelの> 33 </グリッド> 34 </窓>
使用してシステムを。 使用してSystem.Collections.Genericを。 使用してSystem.Linqのを。 使用してSystem.Textのを。 使用してSystem.Threading.Tasksを。 使用してSystem.Windowsを。 使用してSystem.Windows.Controlsを。 使用してSystem.Windows.Dataを。 使用してSystem.Windows.Documentsを。 使用してSystem.Windows.Inputを。 使用してSystem.Windows.Mediaを。 使用してSystem.Windows.Media.Imagingを。 使用してSystem.Windows.Navigationを。 使用してSystem.Windows.Shapesを。 名前空間WpfApp6 { /// <要約> ///MainWindow.xaml的交互逻辑 /// </要約> パブリック 部分 クラスのメインウィンドウ:ウィンドウ { パブリックメインウィンドウ() { のInitializeComponent(); } } パブリック クラスCustomTextBox:テキストボックス { 公共 オーバーライド ボイドOnApplyTemplate() { 塩基.OnApplyTemplate()。 VAR btnclear = GetTemplateChild(" btnclear ")などのボタン。 btnclear.Click + = Btnclear_Click。 } プライベート ボイド Btnclear_Click(オブジェクト送信者、RoutedEventArgs E) { 本文 = ストリング.Empty。 } } }