zip. The labels and custom radio buttons behave as I expect, but the textboxes will not stretch horizontally to fill the viewbox (sorry can't post image because of rep). Once you select the button or any other control and navigate to the Layout tab in the. You. I can tell by the background color that the StackPanel is taking up the whole window. The problem is the stack panel will only stretch to the size of the child elements so in your example you will only see one Textblock of 130 pixels and you will not see the TextBox. Add (realImage); The StackPanel does not enlarge to 50px though; it's stuck to 10px, cutting. Instead it stretches it content in one direction, allowing you to stack item after item. . With only one row using that setting, it gets all of the leftover space. Inside of the that StackPanel can be multiple stackpanel with elements in them stacked vertically. Children. /> <StackPanel>. Name = title; button. How to stretch a Rectangle inside a Button? 0. The upper left and upper right corners of the blue border and the lower left and lower right corners of the red border are sticking out of the curved edges of the first. Explicit Width and Height values take precedence. It is one of the popular panels because of its simplicity. To get rid of artifacts behind the rounded corners in the first example (which you can see when you magnify that with the Snoop tool for example) you must also bind BorderThickness (the same way) and set BorderBrush to White. (I set the window background to Gray so that your white text and border would be visible. However, I am trying to bind the height of a StackPanel to its containing Grid. 8?: Yes; Problem description: If you create a StackPanel, with horizontal orientation, and put a textbox within it (with the default auto width) the textbox doesn't fill the Stackpanel, it defaults to a width of 6. <Grid> <Grid. If you want to fill exactly the width of the window, just replace the outer StackPanel by a Grid. They are primarily used to arrange UI elements that are very unlikely to change size. In the meantime I'll try to work out how this works in WPF. Controls in WPF by default resize according to the layout behavior of their parent. Dock="Bottom" on the ItemsControl, it'll fill the bottom of the DockPanel, so if I. Using Twilio Lookup in . The scroll bar displays but will not allow for the user to move the scroll bar at all. Set the ItemTemplate of the control to a DataTemplate that will be used to display each item in the list. StackPanel in ScrollViewer WPF. I had my Grid inside a StackPanel and the StackPanel was forcing the Grid to be as small as possible, thus the TextBox wouldn’t expand either. You can then use the VisualBrush to. The rectangles expand to fill the entire width of the StackPanel. When i understand your question right, you want that the full space is yellow and the stackpanel with buttons is centered in the middle. I think the first example might be a similar situation, where Column2 is rendering at 0px because it has no content, however I am not sure why it is setting aborder2 to a width of 110. A StackPanel is not the correct Panel to use for your requirements as they do not provide the same layout and resizing capabilities as a Grid. Introduction. With a StackPanel you just follow the nesting, this is easier and less messy than a grid. I find a better answer. I want this to wrap" TextWrapping="NoWrap" FontSize="13" Margin="0,0,0,0"/>. Fill StackPanel inside DockPanel. Globalization; using System. This problem occurs because WPF's default template for TreeViewItem is set up as a 3-column by 2-row Grid. DockPanel. The default stack direction in a StackPanel is vertical. Unfortunately the IValueConverter approach will not always work; if the children are added to StackPanel statically, for example, the child collection will be empty at the time of binding (so I discovered). HorizontalAlignment%2A and. If you mean, you want to scroll through multiple items in your stackpanel, try putting a grid around it. StackPanel asks its children about their desired sizes. 1. I need to be able to fill a stackpanel with buttons but the buttons must appear at the bottom of the stackpanel first and populate upwards. When I started WPF development, I was new to XAML and the first confusion in my mind was about the usage of Grid and Stack panel. For instance, if a list has a 50% (0. Connect and share knowledge within a single location that is structured and easy to search. CustomContent> <Button Content="Second" />. – Bolu. At the first stage, the control tries to calculate its desired state. And I dlike to animate a "hiding" right stackpanel and resize a window to the. We added the reference of "Child. A horizontal StackPanel will always arrange its children to the left edge and children will never stretch. This will cause them to evenly distribute the space within the parent container (even in the case of a resize). I would recommend using DockPanel as the root control for your UserControl so that you could get the behavior you are looking for in its Child Controls. Resizing the window doesn't change anything for the buttons, but. In the previous article, WPF Layout: GridPanel, I discussed the GridPanel. (readonly)ExtentHeight - Gets a value that contains the vertical size of the extent. <Grid> <Menu x:Name="menu" HorizontalAlignment="Left" Height="25". Remove the stackpanel. )AncestorType "StackPanel" in combination with AcestorLevel as "2" binds the Content property of button with Name Property of StackPanel (Parent_2). Orientation="Horizontal" in the main tag! While the promoted answer is great, here's an alternative if you want the items to stretch. Set two children elements with equal width, each with 50% in wpf. kirenenko: GroupBox Height = 106 & StackPanel Height=84. Layouts are the mechanism that WPF uses to define how visual items will be displayed on the screen for standard 2D applications. Data; using System. The other way is fix ViewBox on the top of. What I want is to set the height of the vertical stacks to the actualheight of the outer horizontal stack. 19. ItemContainerStyle> <Style TargetType="ListBoxItem"> <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter. 1. I have tried all 3 as the containiner for the StackPanel, but the height will not propertly adjust to fill it. 2), the net visible opacity for that list item will be rendered as if it were 10% (0. I have a StackPanel containing a StackPanel and some other items. In the Grid class, there is an attached property called IsSharedSizeScope. StackPanel childs auto resize. The key here is to bind to ActualHeight of the other StackPanel. I've a TextBlock and a Slider in a UserControl, the slider is spring loaded and does jog / shuttle; the current value has to be displayed because the user can't rely on the neutral cursor's position, so the textblock. In. Learn how to create a StackPanel, which allows you to stack elements in a specified direction, via the included example in XAML. e. autogrid c-sharp dotnet +7 more tags. e. The parent is ContentControl and through dp-inheritance, the FontSize is taken from the parent (ContentControl), and the. Otherwise it will expand to fill all available space and your rows will fill a percentage of the resulting grid. The problem looks ViewBox auto resize cause, you could try to set Stretch property as Fill to make StackPanel stays on the top, but it will make Canvas item shape change when resize the window. If you are using dynamic layouts with stretching, etc. A Border element encapsulates a parent StackPanel, with a Padding value of 15 device independent pixels. The WPF includes a comprehensive suite of derived panel implementations that enable many. NaN. I want the background of the UserControl to cover the whole UserControl of course. I am trying to get a scroll bar to be placed on a stack panel. The user control uses the following to set it's height and width; The grid for the user control is defined as follows; The idea is to have the content of the 4th row of. C# WPF Stackpanel layout. Panel is the base class for all elements that provide layout support in Windows Presentation Foundation (WPF). 7. In the following XAML the button will stretch to fit the width of the window, including as you resize the window. It is the StackPanel's "fault". If it's something like Stackpanel you can check the Children-Property. 22. Jul 14, 2017 at 14:20. StackPanel. Footer --> <Grid Grid. Row="2"> <!--. (TextBlock with the binding to OriginalQoute has no explicitly set width!) At the second stage, control is arranged. It is very simple, it has one Border, on label and one button. I wish you could just do something like StackPanel. This is because the mouse pointer is no longer over the MyRect. ヘルプボックスは一番下まで伸びているはずです。. Some of these vertical stacks have more or less elements in them then the ones next to them. The problem is that when I set the background of the UserControl, the color only goes down as far as the content. The parent Canvas reads these attached property values from its children during the Arrange pass of layout. To make the textbox as wide as the list you first need to. Height property. Try using Dockpanel. public class Item { public Brush Fill { get; set; } } And set the ItemsSource property of the ItemsControl to a collection of such objects:. WPF Stackpanel overlaps. it's to "Stack" items vertically/horizontally and works based on it's children's desired height than what's available. With ContentPresenter, most times, this does the job: <ContentPresenter /> The default ContentSource is "Content". I'm really new to WPF and I am trying to make an app that will display Word,PDF, and Excel files in it. The following example introduces two Grid elements as child elements of a parent DockPanel. Use a dockPanel with LastChildFill=true and then put inside the WindowsFormsHost with Horizontal and Vertical Alignement to Strech, and of course the WindowsForms control have to fill. By definition, a stackpanel has infinite length. There are two Orientations supported. Set the container (Grid) to the size of the extents, then place the path in it. Ask Question Asked 10 years, 5 months ago. Try adding the following style: <ListBox. For this to work don't forget to name the Grid containing the Listbox. The two buttons stretch vertically to fill the height of the yellow, horizontally orientated StackPanel but their width is determined by their contents. The following code snippet creates a StackPanel at design-time using XAML. <DockPanel LastChildFill="True"> <StackPanel DockPanel. I am attempting to write a simple WPF learning project which creates a set of buttons inside a resizeable main window. You think about exactly what you want to do and use a grid rather than a stackpanel. しかし. The following example creates a simple user interface (UI) framework using a DockPanel element. Without StackPanel (or something similar), the default is to respect the control's VerticalAlignment, and if that's set to the default value of Stretch, then the control is stretched to fill its parent. (Available only for WPF projects. 编辑 Height 将使 StackPanel 更大-true。. Since this is not parent of TextBox and TextBlock so it must have a Name to bind with its Actualwidth --> <Grid x:Name="WidthRestrictorGrid" Grid. 2. In order to distribute the space evenly, you could use a Grid with the default star-sizing ( * for each row). For templates, the Parent of the template eventually will be null. Matt Small - Microsoft Escalation Engineer - Forum Moderator If my reply answers your question, please mark this post as answered. Name = "canvas"; // create the binding for the Canvas's "ActualHeight" property var binding = new System. There are a few problems with your current code. v17. It will allow it's children to get how much ever space they desire. Place everything that needs to stay at the bottom here --> </Grid> </Grid>. It is the container of the Grid that is imposing on its width. Viewed 18k times. There is no maximum width. Row="1"). 3 Answers. . ただし、一部のパネルでは引き伸ばしが無効になります。例えば、横方向配置のStackPanel (Orientation= Horizontal)ではHorizontalAlignmentがLeft指定のように動作しますし、Canvasでも無視されます。これは各種パネルのレイアウトの特徴を考えれば自然なことだと理解. Sorted by: 5. on the elements in the correct order from Right to Left. Column="0" Text=" {Binding Name}" />. Although developers and or designers can customize the appearance extensively on an. I would bet that your ListBox is filling the width of its parent container, but the ListBoxItems within your list box are not stretching horizontally. A StackPanel will provide to its content as much space as required but also only as few as necessary. A StackPanel places child elements in a vertical or horizontal stack. Row="2"> <!--. The StackPanel won't stretch to fill its container, as you noticed. If you are using dynamic layouts with stretching, etc. And, if I move the button to the root, instead of having it as a child of StackPanel, the stretch vertical alignment there will cause it to fill up the window. Star-sizing only works with Grid. Controls. for someone coming from winforms too: the paradigm changes, in winforms the elements itself define the position, in wpf the PARENT define the position of the child, keep that in mind and you will have no problem. I've tried: VerticalContentAlignment ="Stretch" in the UserControl. If your items are wider than the ListBox, the other answers here won't help: the items in the ItemTemplate remain wider than the ListBox. This is how you specify auto sizing behavior in code. Grid. The stackpanel was overriding the stretch properties of the grid in the page. <ScrollViewer x:Name="TS" Grid. Tutorial Data. 106-84 seems to be the height of the GroupBox header plus the internal border size. > <ListBox. Then you should wrap the StackPanel. Robert Rossney has a good solution. For the Rows? Use RowDefinitions and ColumnDefinitions when dealing with Grid. When dealing with layout containers, Aim to. Windows. However neither achieve the desired result, the StackPanel compresses all the items and the DockPanel will either fill the space of the parent control with a large portion of. // Create a WrapPanel and set its properties. It stacks its child elements below or beside each other, dependening on its orientation. Since I wrote, I changed the grid height to auto, which, when I run my app, the grid, since it is the last control in the StackPanel, takes up only a portion of the remaining space in the window when it is first shown - maybe 80 of the 390. 因此,如果要保证它们将一直填充到窗口的整个下方,可以设置将面板的高度调整为窗口 (或其余部分)的高度,然后将. A Border element encapsulates a parent StackPanel,. However neither achieve the desired result, the StackPanel compresses all the items and the DockPanel will either fill the space of the. It shows the StackPanel when the mouse pointer is moved over the MyRect Rectangle. StackPanel simply stacks things next to each other. You try something like to set the textbox to the width of the parent and use a margin for your subtraction <TextBox HorizontalAlignment="Stretch" Margin="0,0,20,0" Please sign in to rate this answer. Stack panel is a simple and useful layout panel in XAML. ItemContainerStyle. In this section, we’ll take a look at the different layout properties you can find at PoshGUI along with their functionalities. . I have a custom control ButtonRow which will end up going into a different control. StackPanel is used to arrange child elements into a single line that can be oriented horizontally or vertically. In other words, the rows will resize with the window. When i understand your question right, you want that the full space is yellow and the stackpanel with buttons is centered in the middle. Stretching of WPF StackPanel. The labels and custom radio buttons behave as I expect, but the textboxes will not stretch horizontally to fill the viewbox (sorry can't post image because of rep). The ScrollViewer Control. A StackPanel enables you to "stack" elements in an assigned direction. I'm really new to WPF and I am trying to make an app that will display Word,PDF, and Excel files in it. But I see now way to do it other than setting an explicit width on the Border . Also, I've always wanted a simple container which would apply a margin but only between child elements. It currently just sizes to the height of the controls in the StackPanel (the Add and Remove buttons), and resizes to accomodate items that are added. Dock="Right" Height="23" VerticalAlignment="Top" HorizontalAlignment="Right"/> <ProgressBar Height="23" VerticalAlignment="Top" /> </DockPanel>. Set the values of HorizontalAlignment and VerticalAlignment for the ListBox to "Stretch". The StackPanel won't stretch to fill its container, as you noticed. A couple of thoughts: Remove the TextBlock Width and set the StackPanel to an Orientation="Vertical" and each TextBlock will now take up 100% of the available width of. Create a new Visual and use it to set the Visual property of the VisualBrush. TemplatedParent is Property which enables you to create a Control template with few unknown values. First off, wrap your StackPanel in a Canvas so it can be easily positioned according to where the user drags it. Rectangle rect = new Rectangle (); TextBox box = new TextBox (); box. My structure looks like this: Scrollviewer --Stackpanel(Horizontal) ----Grid ----Grid ----Grid. If you want scrollbars, just set it's AutoSize=false and AutoScroll=true. However, WPF supports this feature in a different manner using an asterisk (*) suffix with a double number. To get the functionality you desire you should use a grid with two columns one 130 pixels and the other being * to fill up the entire column space that is available. I want my design to be reactive so that if the rectangular container is made taller than it is wide, then my child elements are arranged vertically and still fill the. The DockPanel partitions available space to its child elements. This is the correct answer. Modified 11 months ago. Center controls in a StackPanel WPF. When Star is selected as the height or width of a row or column, that column or row. Don't want to use a Wrap Panel. StackPanel A StackPanel arranges child elements in a single line that can be oriented horizontally or vertically. 22. The image dimensions are 640 X 480. Since your StackPanel has an Horizontal orientation, the TextBlocks with just keep stacking, well, horizontally. Layout in WPF is heavily influenced by the parent container. Hidden; Canvas can = new Canvas (); StackPanel panel = new StackPanel (); txt. 13. StackPanel does not limit the size of container and hence all the space is available to its child elements. I'm currently using a grid designed to fill a rectangular shape which is wider than it is tall. Then the ScrollViewer will take up the space the Grid assigns it. I have checked that all of the Heights and Widths are set to Auto, and Horizontal/VerticalAlignments are set to Stretch, and Horizontal/VerticalContentAlignments are also set to Stretch. Basically I need a stackpanel that will fill its parent and where the children will fill the panel. By default, a StackLayout is oriented vertically. The ItemTemplate property tells the ListBox which property of each item in the list should be used for display. <DockPanel LastChildFill="true"> <WindowsFormsHost HorizontalAlignment="Stretch" VerticalAlignment="Stretch">. In this case, that's a ListBoxItem, which is left-aligned by default. Background. a circle with a cross at the bottom. If there are only three, the height of the entire grid should be short and the content in the left scrollviewer should scroll. NET Framework 4. I would also like to add a comment that I couldn't get this to work when I also set HorizontalAlignment="Left", but when I removed it, it. <StackPanel Orientation="Vertical"> <TextBlock>Left</TextBlock> <DockPanel> <Button HorizontalAlignment="Right">Right</Button> </DockPanel> </StackPanel>. Actual behavior:4. Sorted by: 88. If you want the panel grows instead of showing scrolls, you can set the panel AutoSize=true and AutoScroll=false. The Orientation property can be used to control content flow. StackPanelの子に最大スペースを下方に埋める方法は?. You're trying to hard :) Sometimes XAML can be easy. Although you can use either DockPanel or StackPanel to stack child elements, the two controls do not always produce the same results. 1. The StackPanel is very similar to the WrapPanel, but with at least one important difference: The StackPanel doesn't wrap the content. Sorted by: 2. I took the Polygon sample from MSDN and warped it with a ViewBox with StretchDirection="UpOnly". UPDATE >>>. I want the ListBox to stretch vertically by anchoring to the bottom of the window. ColumnSpan="2" Grid. If you want the StackPanel to fill at least the whole with, you can bind the MinWidth to its parent ActualWidth: <StackPanel. Can a Border fill the space of a Stackpanel without setting the width explicity? 5. Try setting your DataGrid's HorizontalAlignment=Stretch and VerticalScrollBarVisibility=Auto. I want the background of the UserControl to cover the whole UserControl of course. The Margin property tells the location of a ListView on the parent control. 0. To get past this point and extend into the logical tree where the template is actually applied, use TemplatedParent. Learn how to create a StackPanel, which allows you to stack elements in a specified direction, via the included example in XAML. StackPanel will fill the width,. Row="1" attached property for child element if you already add it for parent, the Viewbox in following code fill entire cell but image maybe fill part of the. the StackPanel stays on its position (Stay on top, don't go under) while the window is minimized. StackPanel is the second UI element we'll use to create our weather app. Usually I use Height=" {Binding RelativeSource= {RelativeSource AncestorType= {x:Type Window}},. i want to know the height of all items my StackPanel. It is the container of the Grid that is imposing on its width. The StackPanel in WPF is a simple and useful layout panel. 7. sample xaml. VerticalAlignment ="Stretch" in the UserControl. The reason is that StackPanel asks its children what their ideal height is (based on their content), and uses that height. g. I ended up slightly modifying the DockPanel that comes with the Silverlight Toolkit, and it seems to work. The "main" content would be shown last instead of first, but at least the bottom content would be shown in a logical order in your XAML. In my WPF application, I have added ItemControl and I set the background color in it. In a StackPanel the child items always consume only the space they need (in the direction of the orientation of the StackPanel). StackPanel arranges its child elements into a single line that can be oriented horizontally or vertically. StackPanelSample. This is set to stretch and will in fact stretch to fill the StackPanel width. <DockPanel Background="Orange" LastChildFill="True. Set two children elements with equal width, each with 50% in wpf. The two rows are made visible or hidden as necessary, in order to accomplish the tree expansion when you click the little triangle-. If you want to fill exactly the width of the window, just replace the outer StackPanel by a Grid. Windows. Ask Question. Row="1" HorizontalAlignment="Stretch" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Disabled". The default orientation is Vertical. Very strange. The IsSharedSizeScope attached property of Grid is defined on the parent DockPanel. RowDefinitions> <RowDefinition Height="*" />. Add a comment. Also, I've always wanted a simple container which would apply a margin but only between child. For example, you can say: HorizontalContentAlignment="Stretch". First, create a WPF application using Visual Studio Community. So there will be no expander or anything like that, but with this code your. In the following example I have a StackPanel with a ComboBox inside. g. ItemContainerStyle> <Style TargetType="ListBoxItem"> <Setter Property. NET Multi-platform App UI (. Fill visible border in StackPanel. Note that the inner StackPanel follows the sizing rules of its parent. Actual behavior: 4. The Parent property is the logical parent, which is different. . I'm currently using a grid designed to fill a rectangular shape which is wider than it is tall. I want to arrange 2 Grids (or StackPanels) incl. Apr 6, 2015 at 19:06. S - I'm adding the StackPanel and it's children (the Image and the TextBlock programatically if it matters). Learn how to choose between StackPanel and DockPanel when you stack content in a Panel, by means of code. However, the TextBlock and blue box are centered. Here is an example of a window with two labeled text boxes and two buttons that resize along with the. The FrameworkElement class exposes several properties that are used to precisely position child elements. What’s the difference and which one to use? Let me guide you about this. It turns out that this can sometimes fail: Height="{Binding Path=ActualHeight, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=StackPanel}}" The reason?This has nothing to do with the ListView. That means that the StackPanel is giving full width to each child control, and then laying them out horizontally - even if that means exceeding its bounded/visible width. A StackPanel works great as far as stretching in one direction (opposite the orientation): it behaves just like a Star sized Grid with one row or column. So there will be no expander or anything like that, but with this code your treeview items will be stretch over the whole parent. 1. Button. As you have set the StackPanel's orientation to Horizontal, the HorizontalAlignment property won't work on child-elements. Sorted by: 5. Type Description; PseudoClassesAttribute: API Reference . AllowInfiniteGridSize static property to True, but in that case, the grid will run slowly. · I think that Grid and DockPanel are the only panels that. This article focuses on the StackPanel in details. Stretch (Default) Child elements are stretched to fill the parent element's allocated layout space. 5 Answers. This example shows how to change the value of the StretchDirection and Stretch properties of a Viewbox. Dock="top">, which effectively "docks" the StackPanel (section) against the top of the DockPanel (overarching container). Learn how to adjust content orientation in a Windows Presentation Foundation StackPanel and the HorizontalAlignment and VerticalAlignment of child content. When you set 100% height for your main stack panel, it means 100% of the parent height, which is the ADT in your case. ButtonSpinner. FrameworkElement. <DataTemplate> <StackPanel Orientation="Horizontal" Margin="0,10" Background="#ffD0D9E6" HorizontalAlignment="Stretch" > <TextBlock Text="{Binding. The stack panel can’t handle this use case. Here are some that do not resize their contents (I'm guessing that you are using one or more of these): StackPanel WrapPanel Canvas TabControl Here are some that do resize their contents: Grid UniformGrid DockPanelWith the following CSS. Feb 22, 2016 at 18:01. 0. Panel is the base class for all elements that provide layout support in Windows Presentation Foundation (WPF). To control content flow in a StackPanel, use the Orientation property. In the following XAML the button will stretch to fit the width of the window, including as you resize the window. I have a user control which I want to define as a template in XAML. This solution takes advantage of the attached property Panel. Since you want to have your ViewModels tied to their respective Views, I think it will become conceptually quite tricky if you start to bind to properties and include information from beyond the scope of. In code behind, during runtime, I want to keep adding items (of type my user control) to a Stack Panel. StackPanel / Window width change WPF. Markup; namespace WpfTestBench. In this case these are properties that affect the rendering size. 3 Answers. All WPF ItemsControls like ComboBox, ListBox or Menu use a StackPanel as their internal layout panel. Also, it looks more like you're setting the value of your scrollviewers. This will create a 2x2 grid that will automatically resize if the screen is resized. 22. The left side of the window will show the. qml with the following: import QtQuick 2. StackPanels have infinite client size, so nothing inside a StackPanel will wrap or trim without explicit dimensions being set (instead, the StackPanel just grows to fit the contents). This is true for all containers that don't squeeze. Share. I hope this helps. Load 7 more related. So, is there a way I can get the behavior I want with the out-of-the box panels?Any Panel such as a StackPanel uses a measure-arrange cycle to decide on a layout for its child elements: The key feature of a StackPanel is that it has infinite space -- infinite horizontal space if its orientation is Horizontal, and infinite vertical space if Vertical. Children represents the child collection of elements. Things you can do to solve this: Play with the Padding property of the button. Are you new to WPF and confused about using grid and stack panel? If you answered yes, then you are at the right place. Orientation, of type StackOrientation, represents the direction. ItemsPanel> <ItemsPanelTemplate> <UniformGrid Rows="1" /> </ItemsPanelTemplate> </ItemsControl. I did not need to set FlowDirection="RightToLeft". How would I do this? myUserControl myUserControl = new MyUserControl; myStackPanel. The left side of the window will show the. I think by setting HorizontalAligment to Center on the StackPanel you are overriding the behavior of the DockPanel to fill the whole space with the StackPanel. So as I understand it the problem is that you want to lay out controls horizontally in a StackPanel and align to the top, but have the text in each control line up. You can control horizontal alignment by using the HorizontalAlignment property. <Grid> <!-- parent grid or whatever --> <DataGrid HorizontalAlignment="Stretch" VerticalAlignment="Stretch". LayoutUpdated does not work, because the sender of this event is always null and i can not locate what StackPanel was the source. What am I doing wrong ?Rune Jacobsen 2008-08-30 17:28:01.