I am using Border control in my WPF application.
How to display a border control having dashed line border
I am using Border control in my WPF application.
How to display a border control having dashed line border
<Window x:Class="WindowsApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="WindowsApplication1" Height="300" Width="300"
>
<Grid>
<Rectangle Fill="Red" Stroke="Black" StrokeDashCap="Square" StrokeThickness="6">
<Rectangle.StrokeDashArray>
<sys:Double>5</sys:Double>
</Rectangle.StrokeDashArray>
</Rectangle>
</Grid>
</Window>
Thanks for the code. I am not able to use it for the scenario given below.
I have the following code in my project.
The Grid contains other controls like textbox and combobox.
I need to give a dotted line border for the whole grid (gridDetails).
How to go about it
<
Grid Name="gridDetails" Margin="10,0,10,0"><
Grid.ColumnDefinitions><
ColumnDefinition Width="0.491803278688525*" /><
ColumnDefinition Width="0.508196721311475*" /><
ColumnDefinition Width="0.508196721311475*" /></
Grid.ColumnDefinitions><
Grid.RowDefinitions><
RowDefinition /><
RowDefinition Height="0.136507936507936*" /><
RowDefinition Height="0.146031746031746*" /><
RowDefinition Height="0.13968253968254*" /><
RowDefinition Height="0.126984126984127*" /><
RowDefinition Height="0.126984126984127*" /><
RowDefinition Height="0.2*" /></
Grid.RowDefinitions><
StackPanel Grid.Row="0" Grid.Column="0"><
TextBox Name="txtRoleCode" MaxLength="5" Height="15" Text="ID" IsMandatory="True"></TextBox></
StackPanel><
TextBox Height="15" MaxLength="50" Name="txtRoleName" Text="Name" IsMandatory="True" Grid.Row="0" Grid.Column="1"></TextBox><
TextBox Height="25" MaxLength="255" Name="txtRoleDescription" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" Text="Role Description" MaxLines="2" Grid.Row="0" Grid.Column="2"></TextBox><
ComboBox SelectionChanged="cboRoleStatus_SelectionChanged" Name="cboRoleStatus" Grid.Row="1" Column="0" IsMandatory="True"></
ComboBox></
Grid>
Thanks and Regards,
Pradeep
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" >
<Canvas>
<Grid Name="gridDetails" Margin="10,0,10,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.491803278688525*" />
<ColumnDefinition Width="0.508196721311475*" />
<ColumnDefinition Width="0.508196721311475*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="0.136507936507936*" />
<RowDefinition Height="0.146031746031746*" />
<RowDefinition Height="0.13968253968254*" />
<RowDefinition Height="0.126984126984127*" />
<RowDefinition Height="0.126984126984127*" />
<RowDefinition Height="0.2*" />
</Grid.RowDefinitions>
<Rectangle Fill="Red" Stroke="Black" StrokeDashCap="Square" StrokeThickness="6" Grid.RowSpan="7" Grid.ColumnSpan="3" >
<Rectangle.StrokeDashArray>
<sys:Double>5</sys:Double>
</Rectangle.StrokeDashArray>
</Rectangle>
<StackPanel Grid.Row="0" Grid.Column="0">
<TextBox Name="txtRoleCode" MaxLength="5" Height="15" Text="ID" ></TextBox>
</StackPanel>
<TextBox Height="15" MaxLength="50" Name="txtRoleName" Text="Name" Grid.Row="0" Grid.Column="1"></TextBox>
<TextBox Height="25" MaxLength="255" Name="txtRoleDescription" TextWrapping="Wrap" AcceptsReturn="True" VerticalScrollBarVisibility="Visible" Text="Role Description" MaxLines="2" Grid.Row="0" Grid.Column="2"></TextBox>
<ComboBox Name="cboRoleStatus" Grid.Row="1" Grid.Column="0" >
</ComboBox>
</Grid>
</Canvas>
</Page>
Thanks,.....Your solution worked for me.