Note that there are some explanatory texts on larger screens.

plurals
  1. POSimple WPF 'panel' issue
    primarykey
    data
    text
    <p>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)</p> <p>the code:</p> <pre><code>&lt;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"&gt; &lt;Grid x:Name="gridCtrl"&gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition x:Name="clnmLbl" Width="Auto"/&gt; &lt;ColumnDefinition x:Name="clnmPnl" /&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Label x:Name="lblText" Grid.Column="0" Content="" VerticalAlignment="Center"&gt; &lt;/Label&gt; &lt;DockPanel x:Name="pnlDock" Grid.Column="1"&gt; &lt;Button x:Name="btnLeft" HorizontalAlignment="Left" DockPanel.Dock="Left"&gt; &lt;/Button&gt; &lt;Border x:Name="BorderOfSlider" BorderBrush="#FF000000" BorderThickness="3,3,3,3" CornerRadius="8,8,8,8" &gt; &lt;Slider x:Name="sldSlider" HorizontalAlignment="Stretch" VerticalAlignment="Center" &gt; &lt;/Slider&gt; &lt;/Border&gt; &lt;Button x:Name="btnRight" HorizontalAlignment="Right" DockPanel.Dock="Right"&gt; &lt;/Button&gt; &lt;/DockPanel&gt; &lt;/Grid&gt; &lt;/UserControl&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload