views:

14

answers:

0

Hi I have a userControl which pretend to be a rhombus shape control. On this control I have a textbox and label. Entire control looks like that

<UserControl  HorizontalAlignment="Left" x:Class="WPFDiagramDesignerControl.Components.UcWBSBlock"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Height="87" Width="161"  ToolTip="{DynamicResource BasicTooltip}" MinWidth="151" MinHeight="86" MaxHeight="154"  MaxWidth="265"  >
<UserControl.Resources>
    <ResourceDictionary Source="TextBoxStyles.xaml"/>
</UserControl.Resources>


<Grid x:Name="MainGrid" ShowGridLines="False">
    <Grid.RowDefinitions>
        <RowDefinition Height="20"></RowDefinition>
        <RowDefinition></RowDefinition>
    </Grid.RowDefinitions>

        <Path Grid.RowSpan="3"  Grid.ColumnSpan="3" Data="M 20,0 161,0 141,87 0,87 20,0 " Fill="{StaticResource MileStoneBrush}" Stretch="Fill"  />
     <Label Grid.Row="0" DockPanel.Dock="Top"  Content="{Binding Path=_SppCode}" HorizontalContentAlignment="Center" HorizontalAlignment="Stretch"  Name="label1" Height="25" VerticalAlignment="Top" Style="{StaticResource LabelStyle}" ></Label>
    <TextBox  Grid.Row="1" x:Name="txtBox"  Style="{StaticResource DefaultStyle}" HorizontalContentAlignment="Center" >
        <TextBox.Text>
            <Binding Path="_Name">

            </Binding>
        </TextBox.Text>
    </TextBox>

</Grid>

alt text

I added some functionality to that control, thanks to which I can resize it with mouse. By default I can't enter text in textbox which is on control. However if I doubleclick the control I must change the background of textbox and enable user to write on it. The problem is that after doubleclick user can see that textbox doesn't fit into rhombus.

alt text

I was trying to use margin property and padding property but nothing works. If I resize my control eventually textbox won't fit into rhombus. Could You help me figure this out