In the example below, the TextBox will resize if the text ever grows past the width of the TextBox. How do I prevent the Textbox from increasing in width? I want neither the Textbox or the SplitPane to change size if the text is too large to fit in the Textbox.
<igDock:SplitPane Name="splitPaneWFProperties" igDock:XamDockManager.InitialLocation="DockedRight" ScrollViewer.HorizontalScrollBarVisibility="Disabled"> <igDock:ContentPane x:Name="variableToolboxPane" AllowClose="False" AllowDockingBottom="False" AllowDockingTop="False" AllowDockingFloating="False" AllowFloatingOnly="False" AllowInDocumentHost="False" AllowDockingInTabGroup="False" Header="Variable Toolbox" ScrollViewer.HorizontalScrollBarVisibility="Disabled"> <TextBox></TextBox> </igDock:ContentPane> </igDock:SplitPane>
Thanks.
Since there is no Width set on the root SplitPane, it will size based on the content. So for a pane docked left/right you can set a Width on the root SplitPane.
I don't want to set the size of the root SplitPane. It is inside a XamDockManager and I want it to take up all the available space relative to the size of the window and the space left over from the other Panes inside the XamDockManager.Panes.
Then I don't understand what you want. You stated that you didn't want the splitpane to change size. If you have a SplitPane that is filling the available area then it will get wider/smaller as the containing XDM does. As a consequence the ContentPane within it will get wider/smaller. The Content of that ContentPane will then get wider/smaller.
If you don't want the Content to get wider/smaller then you could either put some sort of Panel in the ContentPane that has the layout settings you want - e.g. a Grid with a column definition with a fixed extent, etc. - or set an explicit width on the textbox and set its HorizontalAlignment to Center/Left/etc. or set the HorizontalContentAlignment of the ContentPane to Center/Left/etc.
There is currently no concept of having a fixed size pane in the xamDockManager. You could try setting the MaxWidth but you would likely get some unexpected results when it has siblings (or its nested and its ancestor has siblings) and you resize the splitter bar.
Below is XAML that illustrates the problem. On the left are the Infragistics Containers. On the right are the Native WPF 4 Containers. Click into any textbox in the Infragistics Containers and enter text. You will see the TextBox grow. Examine the XAML, you will see I wrapped one of them with a native WPF Grid control as you instructed. The result is the same.
Click into one of the Native Containers and enter lots of text. The TextBox will not grow. Something causes the Infragistics controls to resize and I need to squash it as it is screwing up my DataTemplate in a much more complex arrangement of panels than presented here.
I have seen this before regarding ListBox and Item DataTemplates. To resolve the problem it in that case was to disable the HorizontalScrollBar. This does not work with the infragistics containers.
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<!-- Infragistics Layout -->
<igDock:XamDockManager Theme="Office2k7Blue" Grid.Row="0" Name="dockManagerTop">
<igDock:XamDockManager.Panes>
<igDock:SplitPane Name="splitPaneWFToolbar" igDock:XamDockManager.InitialLocation="DockedLeft" HorizontalAlignment="Stretch" >
<igDock:ContentPane Header="Header 1" Name="contentPaneWFToolbar" AllowClose="False" AllowDockingBottom="False" AllowDockingTop="False"
AllowDockingFloating="False" AllowFloatingOnly="False" AllowInDocumentHost="False" AllowDockingInTabGroup="False">
<DockPanel LastChildFill="True">
<TextBox HorizontalScrollBarVisibility="Disabled" >Infragistics Container</TextBox>
</DockPanel>
</igDock:ContentPane>
</igDock:SplitPane>
<igDock:SplitPane Name="splitPaneWFProperties" igDock:XamDockManager.InitialLocation="DockedRight" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<igDock:ContentPane x:Name="variableToolboxPane" AllowClose="False" AllowDockingBottom="False" AllowDockingTop="False"
AllowDockingFloating="False" AllowFloatingOnly="False" AllowInDocumentHost="False" AllowDockingInTabGroup="False" Header="Header 2"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<TextBox HorizontalScrollBarVisibility="Disabled">Infragistics Container</TextBox>
</Grid>
</igDock:XamDockManager.Panes>
</igDock:XamDockManager>
<!-- Native MS controls -->
<Grid Grid.Column="1">
<TextBox Grid.Column="0">Native Container</TextBox>
<TextBox Grid.Column="1">NAtive Container</TextBox>
You're comparing two different things. A grid will take whatever space is left over after giving space to the explicitly sized and autosized columns and divide that space based on the value of the stars (1 for both in your case so 50/50).
XamDockManager is designed to emulate VS and the root docked panes of XDM and VS are more analogous to a DockPanel where the outermost elements are given as much of the associated edge that it wants (so in your case the outermost element is docked left). Since there is no explicit width on that element, the element is measured with the available size and for something like a textbox in the absence of any constraining information will be based upon its content. This is really not much different than doing the following:
<DockPanel> <TextBox DockPanel.Dock="Left">Native Container</TextBox> <TextBox>NAtive Container</TextBox></DockPanel>
Now if you really don't need to have 2 different root split panes then perhaps you could could create a single root splitpane and put both contentpanes into that. The RelativeSize is used to determine how much "weight" each child of a splitpane has and therefore how much space it will be provided.
Thanks Andrew. The explaination makes sense. I'll replace the Split.