Horizontal percentage stretching of children - c#

What component in MAUI would I use to accomplish such a chart?
It should stretch to 100% width and the elements should have relative widths.
Is this possible with XAML only?
I thought about a grid with one row, but I can't iterate over the children.
Or a horizontal stackpanel, but it won't stretch.
Any idea?

Related

How to use same scale transform on all textblocks in a grid

so I have an nx3 grid full of several textblocks, and I was wondering if there is a relatively simple way to apply the same scale transform on all the textblocks so they end up with the same font.
Not sure how to go about this, but I was thinking maybe. Viewbox all of the textboxes to their grid slot. Select the smallest scalefactor that was applied. Apply the scaletransform to all the textblocks.
Anyway, Is there any other way I could get the max scale transform that can be applied to the text while keeping it within its grid slot?
It might be easier to just have a font size option and use grid splitters, but autoscalability sounds nice
Viewbox all of the textboxes to their grid slot.
Sounds viable, you can use an ItemsControl with a Grid as panel and put the Viewbox into the ItemTemplate. You would need to bind it to a collection of objects that contain the text and row/column info so you can bind the Grid.Row/Column in the ItemContainerStyle.

WPF Grid not keeping its Width and Height

I have a Canvas inside of a Grid in a WPF app. I want to draw a skeleton in Canvas from Kinect data. But the Canvas has a tiny width, probably 1px. The Grid makes it shrink, not keeping its set Width and Height. How to make Grid keep its declared size?
Make sure both the grid and the canvas have HorizontalAlignment="Stretch" and VerticalAlignment="Stretch"

XAML Vertical Scrolling Grid within a Horizontal ScrollViewer

I'm trying to recreate the layout of the Weather app in XAML / C#. I have a ListView full of ListViewItems. It is one of several objects within a ScrollViewer. The end result should be that the user can scroll horizontally through the Objects, but stop on the ListView and scroll vertically.
For the effect to work, the ScrollViewer must match the height of the page, and the ListView must match the height of the ScrollViewer, without stretching it.
I can't figure out how to do this without using code-behind to find the Window.Current.Bounds and apply the height to the ScrollViewer, this seems like a dirty hack. Is there a way to do this purely in XAML?
The ListView has its own scrollbar stuff, without needing a ScrollViewer. Otherwise to make things stretch it should be pretty easy - how are you putting things in the ScrollViewer? Through a Grid? A StackPanel?
This may be what you are looking for, but you may find it useful to achieve a 'weather app' look and feel:
http://dotnetbyexample.blogspot.co.uk/2012/08/a-winrt-behavior-to-turn-flipview-into.html

DataGrid and ScrollBar styling WPF

I'm creating DataGrid style in WPF. Now I have rounded corners in my DataGrid, but when appears ScrollBar, it looks not beautiful. DataGridHeader corner is still rounded, and I can see space between corners of ScrollBar button and DataGridHeader. Here is an image:
I need to show rounded corners only when DataGrid hasn't ScrollBar.In all other cases I need to show this:
So how to remove dynamicaly that space on the first image?
Style Scrollbar so that it overlaps the the grid by using negative left margin value

Scrollbar Style

How can I remove the small rectangle that appears when a horizontal and vertical scrollbar appear?
I assume you are using a ScrollViewer. The default template of a ScrollViewer is a Grid containing two rows and two columns. The upper left cell contains the ScrollViewer content, upper right the vertical ScrollBar, lower left the horizontal ScrollBar, and a Rectangle on the lower right cell. Please check this article: http://www.eggheadcafe.com/tutorials/aspnet/f51ddf8c-5227-4f1b-a5df-ec3d1b3439ca/styling-the-wpf-scrollviewer.aspx. You can see the default template there. You could remove the rectangle and then set either the ColumnSpan of the horizontal ScrollBar or RowSpan of the vertical ScrollBar to cover the lower right cell. Hope this helps.

Categories