
The values of widths to change the number of rows will need to be manually tweaked in order to look better with different size objects, and when adding or removing from the ItemSource, Resize() will have to be called to recalculate the dimensions of the elements, for it to look correct. Int numOfItemsToFill = grid.MaximumRowsOrColumns - libraryitems.Count Īrea.Padding = new Thickness If (libraryitems.Count < grid.MaximumRowsOrColumns & libraryitems.Count != 0) If (numofColsOrig != grid.MaximumRowsOrColumns) If (width = 2) Area.Padding = new Thickness(0) If (width >= 2800) grid.MaximumRowsOrColumns = 8 Int numofColsOrig = grid.MaximumRowsOrColumns Var grid = (WrapGrid)showsPanel.ItemsPanelRoot
TUBECAST APP CODE
In order to scale the elements when the page is loaded, and scale them when the page is resized, the code looks like this: private void showsPanel_Loaded(object sender, RoutedEventArgs e)Īrea.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)) įillGaps(showsPanel.ItemsPanelRoot as WrapGrid) The ItemTemplate is then defined as well (Requiring the Base Grid 'MainGrid' to be the same dimensions as the WrapGrid's ItemWidth and ItemHeight).Įvents that are required are SizeChanged on the Base Grid and Loaded on the ItemsControl. The Itemscontrol is defined as a WrapGrid, meaning that Item Width has to be defined, meaning this won't work variable sized controls inside (Although possible with some modification). The inner Grid "Area" has its Height and Width bound to the base Grid 'maingrid', so it maintains the aspect ratio of the page. The Viewbox is wrapped into a Grid, so that Vertical and Horizontal Alignment still works inside the ScrollViewer. This is the XAML structure required to scale the content. I figured out a way to make the controls scale to screen sizes, so that they will take up all available real estate, and works well on all devices.
TUBECAST APP WINDOWS 10
Is there a control like this that exists for UWP apps? Or will it need to be created manually using C#, or added to the platform later? This control is likely essential for future Windows 10 App development. I tried using a variablesizedwrapgrid, but it wasn't any more helpful. This XAML page has a min properties of 135x200, and a max properties of 270x400, using static item height and with of 270x400 and visual state groups to change to 125x200 when the width goes below 720px.
TUBECAST APP TV
What I am looking for is something like a wrapgrid (What I am using below), except that it changes the column width to fill the space when it is resized, like what occurs with the Tubecast app for windows, when you resize the window the columns will expand, or when shrinking, merge once they hit a minimum value.Ĭurrently I am using a wrapgrid control to fill the TV shows into the library, adding a new frame in code, navigating it to a new instance of the LibraryModel Page, passing a class via the onNavigatedTo() method. I have been looking for a resizeable Universal Windows App (RT, UWP) control for handling different screen sizes and scalable controls.
