Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8851621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:11:58+00:00 2026-06-14T13:11:58+00:00

My goal is to create a usercontrol which will redraw when I change its

  • 0

My goal is to create a usercontrol which will redraw when I change its size in designer. For simplicity I created usercontrol Cross. (I am rather a beginner in WPF).

Cross.xaml:

<UserControl x:Class="WpfApplication2.Cross"
             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" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <Grid Name="Grid1">
    </Grid>
</UserControl>

Cross.xaml.cs (without using statements):

namespace WpfApplication2
{
    /// <summary>
    /// Interaction logic for Cross.xaml
    /// </summary>
    /// 
    public partial class Cross : UserControl
    {
        public Cross()
        {
            InitializeComponent();

            Line l = new Line();
            l.X1 = 0; l.Y1 = 0; l.X2 = 300; l.Y2 = 300;
            l.Stroke = new SolidColorBrush(Colors.Black);
            Grid1.Children.Add(l);
            l = new Line();
            l.X1 = 0; l.Y1 = 300; l.X2 = 300; l.Y2 = 0;
            l.Stroke = new SolidColorBrush(Colors.Black);
            Grid1.Children.Add(l);
        }
    }
}

So when I change the size of a Cross in designer from 300 to 600 I want there 2 lines – [0,0,600,600], [0,600,600,0] rather than [0,0,300,300], [0,300,300,0].

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:12:00+00:00Added an answer on June 14, 2026 at 1:12 pm

    Try using The ViewBox Control , Change your xaml to

    <UserControl x:Class="WpfApplication2.Cross"
             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" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
        <Grid>
            <Viewbox>
                <Grid Name="Grid1"/>
            </Viewbox>
        </Grid>
    </UserControl>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The goal is to create a program which will effectively let the user create
GOAL: Create element which will display current big image and few thumbnails. When somebody
My goal is to create an entry form (addnew.php) that will allow me to
The goal is to create a mock class which behaves like a db resultset.
My goal is to create a C# winform application which has rounded panel, rounded
My goal is create a graph that will hide and show a series depending
My goal is to create a validated IP address field that will be validated
Goal: create webservice that will query database and return rows, then pass it to
I've created an object Chartblock that implements QGraphicsItem. My goal is to create a
My goal is to create a time zone converter that will compare two different

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.