grid

C# Foreach XML Node

◇◆丶佛笑我妖孽 提交于 2019-11-29 12:38:41
问题 I'm saving 2-dimensional coordinates on an XML file with a structure similar to: <?xml version="1.0" encoding="utf-8" ?> <grid> <coordinate time="78"> <initial>540:672</initial> <final>540:672</final> </coordinate> </grid> I can open the XML file and read it via the XmlTextReader, but how do I loop through the coordinates specifically to retrieve both the time attribute and data between the initial and final nodes in some format similar to: string initial = "540:672"; string final = "540:672"

Make a grid column span the entire row

随声附和 提交于 2019-11-29 12:11:59
问题 Imagine we have 2 CSS Grid containers with dynamic columns count based on width . display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); The grid works perfectly, but what if we need to have another grid to have the 1st column to be same as in another grid with the code shown above, but it's another column to span through more cells - depending on how many cells are in the current row. To better understand issue, there are images: On more narrow wrapper: We would need to

how to create a branching vein/river like structure on a square grid

寵の児 提交于 2019-11-29 12:05:01
I am trying to procedurally generate some rivers. I have a flat (no concept of elevation) square grid as base and want to draw a branching structure on it like shown in the image. Can you share the steps that one may use to get that done? I am not looking for the fastest implementation as there is no real time generation, but the simpler implementation will be prefered. Lua is my language but anything will do. Few more things: The shape should be generated algorithmic ally. The shape should be controllable using a seed value. Spektre I think generating rivers is a backward approach as you

Use ScrollViewer inside another Scrollviewer

耗尽温柔 提交于 2019-11-29 11:19:18
The structure of my wpf application is like: <Scrollviewer> <Grid> <Scrollviewer> <DataGrid> My Goal is, if the DataGrid exceeds the height of the screen to use it's own Scrollviewer. At the Moment only the outside ScrollViewer is used and so i have to scroll the whole Grid. Can someone please tell me how to do this? Rachel You need to set a height on the inner ScrollViewer, otherwise it'll stretch as much as it needs based on it's content's size. <Window x:Name="RootWindow"> <ScrollViewer> <Grid Height="{Binding ElementName=RootWindow, Path=ActualHeight}"> <Grid.RowDefinitions> <RowDefinition

Make WPF/SL grid ignore a child element when determining size

£可爱£侵袭症+ 提交于 2019-11-29 11:05:10
I have a Grid which has several children, one of which is a ScrollViewer. I want the Grid to size itself based on all of its children except the ScrollViewer, which I want to just take up the space that is created by sizing the Grid for the rest of its children. (For example, the Grid is 2x2 and the ScrollViewer is in Row 0, Column 0, and so the other three Grid entries are enough to determine the dimensions of the Grid.) Is there a nice way to do this? I've looked into creating a Custom Panel either to replace the Grid or to contain the ScrollViewer, but at no point during the MeasureOverride

Swift: How to declare a 2d array (grid or matrix) in Swift to allow random insert

。_饼干妹妹 提交于 2019-11-29 10:45:31
I need to be able to store information about cells in a 2d matrix or grid. Data is not contiguous so I may need to store data at 5,5 when there is no data at lower rows and columns. My first thought was an array of arrays dynamically sized. But Swift arrays have bounds that do not grow automatically. If I attempt to place something at index 5 and thats beyond its current size it fails with out of bounds exception. Is there a collection class in Swift or Cocoa which supports random access to a grid. NSArray doesn't support it either. Another thought was to store the elements in a dictionary and

is there a datatemplate for grid panel elements in WPF?

强颜欢笑 提交于 2019-11-29 09:58:39
问题 Fairly new to WPF... I have a collection of data I would like to bind to a grid panel. Each object contains its grid row and column, as well as stuff to fill in at the grid location. I really like how I can create data templates in the listbox XAML to create a UI with almost nothing in the code behind for it. Is there a way to create a data template for grid panel elements, and bind the panel to a data collection? 回答1: You can use an ItemsControl with a Grid as its panel. Here is an example.

WPF - How to stop TextBox from autosizing?

自作多情 提交于 2019-11-29 09:56:33
I have a textbox in my visual tree as follows.. Window Grid ListBox ItemTemplate DataTemplate Grid Grid Textbox ... The textbox is defined as.. <TextBox Height="Auto" Text="{Binding Path=LyricsForDisplay}" MinHeight="50" MaxHeight="400" Visibility="Visible" VerticalScrollBarVisibility="Auto" IsReadOnly="True" AllowDrop="False" TextWrapping="WrapWithOverflow"> </TextBox> When long text is added to the bound variable (LyricsForDisplay) all of the items in the listbox expand their textboxes/grids width's to allow for the entire string to be seen if you use the scrollbar on bottom that appears...

Writing a string in a spiral

谁说我不能喝 提交于 2019-11-29 09:29:46
问题 I had recently participated in coding competion sponsored by an company and there was this one question which I did not understood, as to what was it asking. Here is the question: The string "paypal is the faster, safer way to send money" is written in a clockwise spiral pattern inside a square starting from the upper left corner: (you may want to display this pattern in a fixed font for better legibility). P A Y P A L F E R W A I A M O N Y S S D Y E T T R N E S O H E T S A F E Then read line

ExtJS 4 and its new MVC: grid: how to handle keys?

烈酒焚心 提交于 2019-11-29 08:13:24
I'm looking for a way to handle the key in the Grid. I've closely followed the examples here: http://www.sencha.com/learn/architecting-your-app-in-ext-js-4-part-1 http://www.sencha.com/learn/architecting-your-app-in-ext-js-4-part-2 http://www.sencha.com/learn/the-mvc-application-architecture/ So now everything works fine, but I'd like to handle keys in my Grid. So I guess in the declaration " this.control({}) " I should just add another event concerning userlist but it seems Grid don't have the "keypress" event. Any idea how I should do (moreover how I should do with the new MVC pattern)? Ext