Questions tagged [wpf-grid]

A wpfgrid is a WPF Panel which arranges child elements in predefined columns and rows.

Full class name: System.Windows.Controls.Grid. Grid defines a flexible grid area that consists of columns (ColumnDefinitions) and rows (RowDefinitions). Child elements are positioned using attached properties Grid.Column and Grid.Row and can take more than one column/row if attached dependency properties Grid.ColumnSpan/Grid.RowSpan are set.

56 questions
0
votes
1 answer

How can I trigger a ValidationRule on a WPF grid based upon its contents, rather than its properties like width?

One can only use a ValidationRule with binding; what's a good way to use Validation.ErrorTemplate with Grid based upon its contents rather than its properties like width, etc.?
puzzlepiece87
  • 1,537
  • 2
  • 19
  • 36
0
votes
1 answer

Grow-Only GridSplitter

I have a pretty simple requirement that I can't seem to find a solution for. Take a look at my sample XAML code:
Keith Stein
  • 6,235
  • 4
  • 17
  • 36
0
votes
1 answer

WPF Trouble with IsSharedSizeScope attribute

IsSharedSizeScope is set as true in the Grid(parent) level with StackPanel as a child then IsSharedSizeScope property is not working but when I remove the StackPanel it works. I am trying to understand what I am doing wrong. Any help would be…
Yogeswaran K
  • 51
  • 2
  • 9
0
votes
1 answer

How can I create and display WPF content from C# code?

I'm working on a WPF App, and I would like to create the entire window from c# code, instead of from XML. I tried the following code, but nothing happens, the grid is not displayed. Did I miss something? Is it possible to do it this way or is there…
Axel
  • 165
  • 3
  • 14
0
votes
0 answers

How do I make all (or most) of my elements use a responsive layout in C# WPF?

So I've used the '*' key to divide the total width into different areas that are responsive. But obviously I can't use grid everywhere, some elements don't support it etc. So my question is how do I keep those elements flexible? The most recent…
rasqall
  • 33
  • 7
0
votes
1 answer

How to get a Grid.Column value in a binding expression

I need set background property by Grid.Column value. My idea was simple DataTrigger like this
Brandon
  • 3
  • 2
0
votes
1 answer

Cannot add different controls to GRID panel in C#

I'm completely new to XAML and WPF and I cannot add other type of control (like TextBox or Label) to grid after adding a button. Could you please explain me where do I make a mistake (I guess it should be some simple mistake by a newbie guy). I've…
ledom
  • 3
  • 2
0
votes
1 answer

WPF TreeView share size of grid column in single level

How to share size of Grid column within single level instead of multiple levels?
Krzysztof Skowronek
  • 2,796
  • 1
  • 13
  • 29
0
votes
2 answers

Binding WPF Grid to a model

I have a MVVM application which has a WPF Grid which contains other embedded WPF Grids and at the same time, each of them contain some fields (WPF TextBlocks). Very simplified example - View: // Row definitions //…
Willy
  • 9,848
  • 22
  • 141
  • 284
0
votes
1 answer

Unexpected auto grid column width

the code below is a small snippet of a big wpf Window I am using in my Project. It produces the linked wpf Window. I am wondering why my last grid column is so wide. I am expecting that the width of the last column depends on the width of the…
0
votes
2 answers

Completely remove Grid lines in WPF

I have a WPF Grid with Rectangles in each column. All columns has equal width (1*) and all Rectangles has black background. In designer mode, there are thin lines between the rectangles (the Grid column lines) what is fine, but my problem is, these…
s3rius
  • 5
  • 2
0
votes
1 answer

Grid with RowDefinitions based on content

I am trying to get something like an image with adjustable margins done. The image itself is actually a path and resides in a StackPanel, stretching vertically. The StackPanel's width can be adjusted, and I want to keep the image's ratio and the…
0
votes
0 answers

Save a Grid and it's contents in a file - WPF, C#

I have a list of Grids with several rows and columns containing StackPanels. Each stack panel contains one or more Image objects, in some cases none at all and some Borders. I would like to save these Grids to a file(sort of save functionality) and…
jikrthrttr
  • 11
  • 2
0
votes
1 answer

Dynamically added elements are not displayed properly in a dynamically adjusted grid

I've got a ItemsControl which should display Images in a Grid. The ItemsControl looks like the following:
tg24
  • 161
  • 3
  • 22
0
votes
2 answers

WPF How to access label in the grid?

I create items in grid on code. Border panel = new Border(); Grid.SetColumn(panel, 3); Grid.SetRow(panel, 3); StackPanel stack = new StackPanel(); panel.Child = stack; Label hasta = new Label(); hasta.Content =…
user8210624