In the following XAML, the word "Test" centers horizontally but not vertically.
How can I get it to center vertically?
<Window x:Class="TestVerticalAlign2343.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
WindowStartupLocation="CenterSc...
I've got a StackPanel with a group of expanders in, how do I set it so that only expander is expanded at any one time?
Cheers
AW
...
Inserting a Slider in a Grid would expand it to fill the available space, but I would prefer not use a grid for the following reason:
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 t...
Here's a trivial example of the problem I'm having:
<StackPanel Orientation="Horizontal">
<Label>Foo</Label>
<TextBox>Bar</TextBox>
<ComboBox>
<TextBlock>Baz</TextBlock>
<TextBlock>Bat</TextBlock>
</ComboBox>
<TextBlock>Plugh</TextBlock>
<TextBlock VerticalAlignment="Bottom">XYZZY</TextBlock>
</St...
I was wondering if I can have 2 controls in a horizontal-oriented StackPanel so that the right item should be docked to the right side of the StackPanel.
I tried the following but it didn't work:
<StackPanel Orientation="Horizontal">
<TextBlock>Left</TextBlock>
<Button Width="30" HorizontalAlignment="Right">Right<Button>
</Stac...
I have good model (I think!) for how to allow a user to drag an element in a stackpanel and reposition it to another location within the stackpanel.
However, my Stackpanel is placed within a ScrollViewer, like this (generalized):
<ScrollViewer>
<StackPanel>
....First item
....Second item
....Third item
...
I have a Canvas inside of a StackPanel in my WPF Designer in Visual Studio 2008. At runtime I plan to resize the Canvas so its client rect is a certain size (borders and other parts are just added onto that size). When I resize the Canvas, will the Width/Height of the StackPanel adjust itself accordingly? This is important since I have o...
How do I define a DataTrigger for a StackPanel? It does have a Trigger property, but defining a trigger here gives the following error on Initialize when starting the application:
Failed object initialization (ISupportInitialize.EndInit). Triggers collection members must be of type EventTrigger. ....
This is given from the follo...
I created the following class in order to have an easy way to display formatted text in a WPF document.
However this solution returns a FlowDocument, and I am having trouble integrating this FlowDocument in my current application in which I was simply adding TextBlocks to StackPanels and WrapPanels and Borders, etc.
How can I add the ...
Hello,
I've been struggling a while with marquee-style image scrolling control.
At a moment, I stuck up with templated ItemsControl:
<Window.Resources>
<DataTemplate x:Key="itemsTemplate">
<Image Source="{Binding AbsolutePath}"></Image>
</DataTemplate>
</Window.Resources>
<ItemsControl ItemTemplate="{StaticResource item...
I am using a grid by the definition of appropriateness defined in this question Grid vs Stackpanel. However when working with grids you have to define the controls position inside them explicitly in the grid. This becomes a pain when having to reorder controls or when adding a new control to the grid. With the code provided as an example...
I have a stackpanel with some usercontrols that are added or removed during runtime.
These elements have an index that i assign to them when i new them, I need to keep these elements sorted by that index so i wote a quicksort function that sorts them based on the index
but on the line that does the swapping
y = items[i]; //y ...
Here is the code I have and wondered how I could completely rollup the stack, expander and objects within it to push all objects below it to take up the space left after rolling up the upper stack and objects. My current code is below:
<Grid>
<StackPanel Margin="8,8,0,0" VerticalAlignment="Top" Height="225">
<Expander Header="Expand...
I am quite new to WPF. I have a page that displays data from a SQL database using L2S. The L2S returns a DataTable that contains all the available options to choose from for a specific area. Every row it returns from the DataBase needs to be a checkbox and I want to put those checkboxes in a stackpanel.
Am I looking at databinding to...
Seen various examples of WPF applications I've seen the use of the Grid control for almost anything, even simplest things with only 1 column or row.
Also, the WPF templates start with an empty grid.
For me, using StackPanel or DockPanel is less verbose and are better for maintenance (think adding a row later and having to add +1 to all...
My stackpanels have gaps between each item (TextBlocks). You can see through to whatever is behind on the background Canvas. I don't want gaps.
I tried setting the margin of both the stackpanel and textblocks to zero. Didn't fix it.
Creating the same thing in Blend shows no gaps (AFAIK).
Here you can see the object behind mouse/moose s...
I want to create a design using Stackpanel in XAML pad in WPF and then embed images on it using .cx file. But I am getting some error using Styles.
<Style x:Key="TopPanelDesign" TargetType="{x:Type StackPanel}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type StackPan...
Here's my XAML code:
<Window x:Class="CarFinder.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Search for cars in TuMomo" Height="480" Width="600">
<DockPanel Margin="8">
<Border CornerRadius="6"
...
I have a grid, 3 by 3 (3 rowdefinitions and 3 columndefinitions). I want some content (a StackPanel) in one of those grid cells to scroll. I'm fairly sure this is possible but I cannot figure out how. I've tried adding ScrollViewers and Scrollbar controls to the grid cell I want to scroll, but this usually ends up creating scrolling for ...
Is there a way to change the draw order of Controls in a StackPanel without changing the actual ordering of these controls in the StackPanel?
The reason I ask is that we have a button bar with margin 0 between the buttons. The active button grows (ie margin set to -10) overlapping the neighbouring buttons. The problem here is that the r...