<UserControl x:Class="PDF_Office.CustomControl.NumericUpDown" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:PDF_Office.CustomControl" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="40" d:DesignWidth="80" Background="#EEEEEE" FontSize="20" mc:Ignorable="d"> <Border> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="auto" /> </Grid.ColumnDefinitions> <TextBox Name="TextBox_Num" MinWidth="80" MinHeight="20" Padding="16,0,0,0" VerticalContentAlignment="Center" Background="Transparent" BorderThickness="0" FontFamily="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=FontFamily}" FontSize="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=FontSize}" Foreground="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=Foreground}" InputMethod.IsInputMethodEnabled="False" PreviewTextInput="CountTextBox_PreviewTextInput" Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=Text}" TextAlignment="Left" TextChanged="TextBox_Num_TextChanged" /> <Grid Grid.Column="1" Width="20"> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition /> </Grid.RowDefinitions> <Button Name="Button_Add" Grid.Row="0" Background="Transparent" BorderBrush="Transparent" BorderThickness="0" Click="Button_Add_Click"> <Path HorizontalAlignment="Center" Data="M8 4.29102L2.14648 10.1445L2.85547 10.8535L8 5.70898L13.1445 10.8535L13.8535 10.1445L8 4.29102Z" Fill="Black" Stretch="Uniform" Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=ShowBtn}" /> </Button> <Button Name="Button_Sub" Grid.Row="1" Background="Transparent" BorderThickness="00" Click="Button_Sub_Click"> <Path Data="M13.8535 5.85547L13.1445 5.14648L8 10.291L2.85547 5.14648L2.14648 5.85547L8 11.709L13.8535 5.85547Z" Fill="Black" Stretch="Uniform" Visibility="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:NumericUpDown}, Path=ShowBtn}" /> </Button> </Grid> </Grid> </Border> </UserControl>