0

I have a simple WPF component that I generate and use as a plugin in a custom-made industry application. However I wish to make the WPF component be stretchable by the user in design-mode. Basically by importing the WPF component the user can then drag and drop it, but so far it is not resizeable.

Here is my code:

<base:Element x:Class="ControlForm.TEST"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:base="clr-namespace:TEST.HMI.Controls;assembly=TEST.HMI"
             xmlns:dc="clr-namespace:TEST.Controls.Display;assembly=TEST.Controls.Display"
             xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
             mc:Ignorable="d" 
             >
    <Grid Height="840" Width="890">


        <StackPanel Background="White">
            <TextBlock  x:Name="Name1"  Text="..." FontSize="14"></TextBlock>
            <TextBlock x:Name="Name2"  Text="..." FontSize="14"></TextBlock>
        </StackPanel>



        <UserControl Height="600" Width="750" Name="MyControl" Background="Black" Grid.Row="2" Grid.Column="1" >

            <WindowsFormsHost Name="Host" Background="Black" Height="500" >
                <dc:Display Name="Control2"  ShowScrollBars="True" Enabled="true" AutoScroll="True" ShowCustomView="False"  />
            </WindowsFormsHost>
        </UserControl>

    </Grid>

</base:Element>
Steven
  • 1
  • You have fixed widths/heights set on the grid and usercontrol. If you remove these, the sizing revert to auto, that should help. – Nzc Jun 02 '15 at 07:27
  • I have done this and the user controls width and height is 0 and 0. is there a way to set a default width and height so it can be seen by the user before they resize it? – Steven Jun 02 '15 at 07:43

0 Answers0