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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:33:53+00:00 2026-06-11T14:33:53+00:00

all windows controls has property called anchor by which i can force control to

  • 0

all windows controls has property called anchor by which i can force control to stick on its surface and if anyone re-size form the controls height & width also increase & decrease along with form size.

i asked some one that how to do it in wpf and he said as below
‘Docking’ in WPF can be done by Setting the HorizontalAllignment and the VerticalAllignment properties of a child control.

‘Anchoring’ in WPF can be done by setting the Margin on the child and/or the Padding on the container.

unfortunately i am not being able to do so. so here is my sample xaml.

<Window x:Class="WpfApplication1.Window3"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window3" Height="300" Width="515">
<Grid>
    <Label Name="lblName" Content="Enter Name" Height="28" HorizontalAlignment="Left" Margin="-17,5,0,0"  VerticalAlignment="Top" />
    <Label Content="Enter Address" Height="28" HorizontalAlignment="Left" Margin="-17,39,0,0" Name="label2" VerticalAlignment="Top" />
    <Label Content="Enter Company" Height="28" HorizontalAlignment="Left" Margin="-17,68,0,0" Name="label3" VerticalAlignment="Top" />
    <TextBox Height="23" HorizontalAlignment="Left" Margin="83,10,0,0" Name="textBox1" VerticalAlignment="Top" Width="222" />
    <TextBox Height="23" HorizontalAlignment="Left" Margin="83,73,0,0" Name="textBox2" VerticalAlignment="Top" Width="222" />
    <TextBox Height="23" HorizontalAlignment="Left" Margin="83,42,0,0" Name="textBox3" VerticalAlignment="Top" Width="222" />
</Grid>
</Window>

so please do edit ny xaml to achieve what i am looking for….thanks

  • 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-11T14:33:54+00:00Added an answer on June 11, 2026 at 2:33 pm

    Here’s an alternative approach. It will give you static layout:

    <Grid>
         <Grid.RowDefinitions>
     <RowDefinition Height="auto"/>
      <RowDefinition Height="auto"/>
      <RowDefinition Height="auto"/>
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
      <ColumnDefinition Width="auto"/>
      <ColumnDefinition Width="auto"/>
      </Grid.ColumnDefinitions>
    
      <Label Grid.Column="0" Grid.Row="0" Name="lblName" Content="Enter Name"/>     
      <Label Grid.Column="0" Grid.Row="1" Content="Enter Address" />     
      <Label Grid.Column="0" Grid.Row="2" Content="Enter Company" />     
      <TextBox Grid.Column="1" Grid.Row="0" Width="200"/>     
      <TextBox Grid.Column="1" Grid.Row="1" Width="200" />     
      <TextBox Grid.Column="1" Grid.Row="2" Width="200"/> 
    </Grid>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, a System.Windows.Forms.Control has a Controls property of type Control.ControlCollection . I have a
Iam using windows forms. How can I query all child controls of a Form
I'm having a windows form. In this form I've datagrid control which has few
Do all the windows and controls (including active-x) displayed inside WinForms application are derived
While loading a Windows Form (C#), I'm trying to iterate through all controls. So
Hey all. I'm wondering how to implement a timeout event in the System.Windows.Forms.Webbrowser control?
How can I write my own structs which can be used as a property
I have an image control in a resizable window with its stretch property set
There is a custom control called TestCustomControl, it inherits from Control and it has
I have a tab in a windows form called Wafer Map that has three

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.