I'm testing to create a text box and textblock fixed size in my view page,but there is problem for rendering TextBoxes.I set fixed size for my textboxes and texblocks but texboxes are bigger than textbocks and I found that problem is for BorderThickness property of textbox,when i set BorderThickness="0" this will fixed problem.
here is my xaml example:
Code: Select all
<Grid Grid.Row="1" x:Name="gridAddEmployee" Visibility="Collapsed" Margin="0,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="auto"/>
</Grid.RowDefinitions>
<StackPanel >
<TextBlock Height="25" Background="red" Margin="0,0,0,0" Text="نام و نام خانوادگی:" HorizontalAlignment="Right" VerticalContentAlignment="Center"/>
<TextBlock Height="25" Background="red" Margin="0,10,0,0" Text="شماره تلفن:" HorizontalAlignment="Right" VerticalContentAlignment="Center"/>
<TextBlock Height="25" Background="red" Margin="0,10,0,0" Text="نام کاربری:" HorizontalAlignment="Right" VerticalContentAlignment="Center"/>
<TextBlock Height="25" Background="red" Margin="0,10,0,0" Text="کلمه ی عبور:" HorizontalAlignment="Right" VerticalContentAlignment="Center"/>
<TextBlock Height="25" Background="red" Margin="0,10,0,0" Text="نام و نام خانوادگی:" HorizontalAlignment="Right" VerticalContentAlignment="Center"/>
<TextBlock Height="25" Background="red" Margin="0,10,0,0" Text="شماره تلفن:" HorizontalAlignment="Right" VerticalContentAlignment="Center"/>
<TextBlock Height="25" Background="red" Margin="0,10,0,0" Text="نام کاربری:" HorizontalAlignment="Right" VerticalContentAlignment="Center"/>
<TextBlock Height="25" Background="red" Margin="0,10,0,0" Text="کلمه ی عبور:" HorizontalAlignment="Right" VerticalContentAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Column="1" Margin="0,0,10,0" Width="200">
<TextBox Height="25" Background="red" />
<TextBox Height="25" Background="red" Margin="0,10,0,0" />
<TextBox Height="25" Background="red" Margin="0,10,0,0" />
<TextBox Height="25" Background="red" Margin="0,10,0,0" />
<TextBox Height="25" Background="red" Margin="0,10,0,0" />
<TextBox Height="25" Background="red" Margin="0,10,0,0" />
<TextBox Height="25" Background="red" Margin="0,10,0,0" />
<TextBox Height="25" Background="red" Margin="0,10,0,0" />
</StackPanel>
<StackPanel Grid.Column="2">
<CheckBox Height="25" VerticalContentAlignment="Center" Content="فعال/غیر فعال"/>
<TextBlock Height="25" Margin="0,10,0,0" VerticalContentAlignment="Center" Text="جنسیت"/>
<TextBlock Height="25" Margin="0,10,0,0" Text="توضیحات:" VerticalContentAlignment="Center"/>
</StackPanel>
<StackPanel Grid.Column="3" Width="200">
<Grid Height="25"/>
<TextBox VerticalAlignment="Center" Margin="0,10,0,0" Text="" Height="50"/>
<ComboBox Margin="0,10,0,0" Height="25" VerticalAlignment="Center"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1">
<Button x:Name="btnAddEmployeeSave" Click="btnAddEmployeeSave_Click" Content="ذخیره"/>
<Button x:Name="btnCancelAddEmployee" Click="btnCancelAddEmployee_Click" Content="انصراف"/>
</StackPanel>
</Grid>