Visual Studio Designer Problem

4 posts, 0 answers
  1. Andriy
    Andriy avatar
    3 posts
    Member since:
    Dec 2015

    Posted 21 Jan Link to this post

    Hello,
    I'm creating a new WPF application and would like to use implicit styles. The application currently uses the VisualStudio2013 theme.

    In Designer everything is fine but when I run my application, the position or size of some controls are changed.

    How can I have the Visual Studio designer or my app display the controls correctly?

     

     Example:

     

  2. Andriy
    Andriy avatar
    3 posts
    Member since:
    Dec 2015

    Posted 21 Jan Link to this post

    Another example.

    Also when I use HorizontalAlignment="Stretch" for control it looks like in designer. But when I use HorizontalAlignment="Left" or HorizontalAlignment="Right" I have this problem.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Andriy
    Andriy avatar
    3 posts
    Member since:
    Dec 2015

    Posted 22 Jan Link to this post

    Another example with new project. Only added groupbox. Maybe problem is with window size. It not the same as in designer. 
  5. Masha
    Admin
    Masha avatar
    355 posts

    Posted 26 Jan Link to this post

    Hello Andriy,

    As you guessed the problem comes from the default WPF Window which looks different from VS designer when running. The margins in WPF window are shown only in the design time. If you want to keep them you need to defined them in Xaml on your parent element. Check the code snippet below:

    <Window x:Class="DemoProject.MainWindow"
            Title="MainWindow"
            Height="140" Width="525">
        <StackPanel Margin="8">
            <GroupBox Header="Title">
                <telerik:RadWatermarkTextBox Text="text" HorizontalAlignment="Left" Width="60"/>
            </GroupBox>
     
            <telerik:RadButton Content=" Button"  HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 2 2 0"/>
        </StackPanel>
    </Window>

    Let me know if this helps. If you still have issues with the designer and runtime look, please share part of  your xaml to check where the problem comes from.


    Regards,
    Masha
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top