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 8884141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:59:33+00:00 2026-06-14T20:59:33+00:00

I was wondering is it possible to create a panel-like control in wpf, and

  • 0

I was wondering is it possible to create a panel-like control in wpf, and another wpf custom control that will be the child of this panel, all in WinForms application. And then, would it be possible to set the custom control’s size in float?
Also would I be able to rotate that custom control?

Thanks in advance

  • 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-14T20:59:35+00:00Added an answer on June 14, 2026 at 8:59 pm

    You will need to use the System.Windows.Forms.Integration NameSpace, more specifically the ElementHost Control, that will allow you to embed a WPF Control in Winforms.


    This is a quick and simple demonstration of changing the WPF UserControls Child UserControls Size and Location. I will leave the animation to you.

    Main Winform Form

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Windows.Forms.Integration;
    
    namespace WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            ElementHost host;
            WpfControlLibrary1.UserControl1 uc;
            public Form1()
            {
                InitializeComponent();
            }
    
            private void Form1_Load(object sender, EventArgs e)
            {
                host = new ElementHost();
                host.Dock = DockStyle.Top;
                uc = new WpfControlLibrary1.UserControl1();
                host.Child = uc;
                this.Controls.Add(host);
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                uc.SetChildLocation =  new  System.Windows.Point(uc.SetChildLocation.X + 25.5, uc.SetChildLocation.Y + 10.2);
            }
    
            private void button2_Click(object sender, EventArgs e)
            {
                uc.SetChildSize = new System.Windows.Size(uc.SetChildSize.Width + .25, uc.SetChildSize.Height + .25);
            }
        }
    }
    

    UserControl1.xaml

    <UserControl x:Class="WpfControlLibrary1.UserControl1"
             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" Background="Red" xmlns:my="clr-namespace:WpfControlLibrary1">
        <Canvas>
            <my:UserControl2 HorizontalAlignment="Center"   x:Name="userControl21" VerticalAlignment="Center" Canvas.Left="0" Canvas.Top="0" />
    
        </Canvas>
    </UserControl>
    

    UserControl1.xaml.cs

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    
    namespace WpfControlLibrary1  
    {
        /// <summary>
        /// Interaction logic for UserControl1.xaml
        /// </summary>
        public partial class UserControl1 : UserControl
        {
            public UserControl1()
            {
                InitializeComponent();
            }
    
            public Point  SetChildLocation
            {
                get
                {
                    return new Point(Canvas.GetLeft(userControl21), Canvas.GetTop(userControl21));
                }
    
                set
                {
                    Canvas.SetLeft(userControl21, value.X);
                    Canvas.SetTop(userControl21, value.Y);
                }
            }
    
            public Size SetChildSize
            {
                get
                {
                    return new Size(userControl21.ActualWidth, userControl21.ActualHeight);
                }
                set
                {
                    userControl21.Width = value.Width;
                    userControl21.Height = value.Height;
                }
            }
        }
    }
    

    UserControl2.xaml

    <UserControl x:Class="WpfControlLibrary1.UserControl2"
             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" SizeChanged="UserControl_SizeChanged">
        <Grid>
            <Rectangle x:Name="rect" Fill="Blue" Height="40" Width="120"></Rectangle>
        </Grid>
    </UserControl>
    

    UserControl2.xaml.cs

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    
    namespace WpfControlLibrary1
    {
        /// <summary>
        /// Interaction logic for UserControl2.xaml
        /// </summary>
        public partial class UserControl2 : UserControl
        {
            public UserControl2()
            {
                InitializeComponent();
            }
    
            private void UserControl_SizeChanged(object sender, SizeChangedEventArgs e)
            {
                rect.Width = e.NewSize.Width;
                rect.Height = e.NewSize.Height;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I 'm wondering if it 's possible to create a script that will continue
I am wondering if it's possible to create a grid-like layout using div's that
I was wondering if it is possible to create a flash movie that rotates
I was wondering if the following is possible. Create a class that accepts an
I'm wondering is that possible to create new eamil account using Exchange Web Service?
I am wondering if it is possible to create something like a predicate for
I'm just wondering if it is possible to create an app (C#) that gives
I was wondering if it is possible to create a 'Bookmark this' button using
I'm wondering if it's possible to create my own services that I can use
I was wondering if it is possible to create a custom strongly typed HTML

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.