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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:34:47+00:00 2026-05-27T04:34:47+00:00

a ‘simple’ about controls layout in wpf. There is a custom control with a

  • 0

a ‘simple’ about controls layout in wpf. There is a custom control with a grid in wich there is ‘panel’ on this panel there are three elements two buttons and slider between them. Right button must be anchored to right side of the ‘panel’, left button to the left side of ‘panel’ and the slider must FILL ALL THE FREE SPACE BETWEEN buttons. The width(and height) of buttons and grid will be set dinamycaly in the code after. The question is – what kind of ‘panel’I must use and how to make it to operate with given task? (stack, dock – have no such functionality even with this “horizontal stratching”)
In WinForms – there are no problem width of slider = widthOfGrid – (widtOfBothButtons)
Is this possible to do it in wpf? Or I must compose the code like above in some constructor-like functions?
(offtop- As for me this is a typical task for wpf control and I am surprized that it has too little automatic to solve it)

the code:

<UserControl x:Class="WpfApplication1.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="42" d:DesignWidth="291">
    <Grid x:Name="gridCtrl">
        <Grid.ColumnDefinitions>
            <ColumnDefinition x:Name="clnmLbl" Width="Auto"/>
            <ColumnDefinition x:Name="clnmPnl" />
        </Grid.ColumnDefinitions>

        <Label x:Name="lblText" Grid.Column="0" Content="" VerticalAlignment="Center">

        </Label>
        <DockPanel x:Name="pnlDock" Grid.Column="1">
            <Button x:Name="btnLeft"  HorizontalAlignment="Left" DockPanel.Dock="Left">
            </Button>
        <Border  x:Name="BorderOfSlider"  BorderBrush="#FF000000" BorderThickness="3,3,3,3" CornerRadius="8,8,8,8" >
                <Slider x:Name="sldSlider" HorizontalAlignment="Stretch" VerticalAlignment="Center" >
            </Slider>
            </Border>
        <Button x:Name="btnRight"  HorizontalAlignment="Right" DockPanel.Dock="Right">
            </Button>
        </DockPanel>


    </Grid>
</UserControl>
  • 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-05-27T04:34:48+00:00Added an answer on May 27, 2026 at 4:34 am

    That sounds exactly like what a DockPanel does…. it will Dock controls to the sides of the panel, and by default the last control added will stretch and fill all remaining space

    <DockPanel>
        <Button DockPanel.Dock="Left" Content="Left Button" />
        <Button DockPanel.Dock="Right" Content="Right Button" />
        <Slider />
    </DockPanel>
    

    Also if you’re new to WPF, I’d recommend taking a look at this site for a quick visual view of WPF’s layout controls.

    Edit

    Make sure your control that fills all remaining space is the last item added to your DockPanel. If not, it will use a default value of DockPanel.Dock="Left"

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Hi if i run my project its indicate this logcat error...how to solve this
Does anyone know how can I replace this 2 symbol below from the string
I would like to count the length of a string with PHP. The string
I've got a string that has curly quotes in it. I'd like to replace
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am currently running into a problem where an element is coming back from
I am trying to create a RegEx expression that will successfully parse the following
I'm creating a web service to transfer json to an iPhone app. I'm using

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.