I'm trying to create a stackpanel in WinRT that will wrap to the next line when needed. I've tried WrapGrid and VariableSizeWrapGrid but seem to be having issues with the item size and layout.
My aim is to have a list of names separated by a "," that when I click on the name I can navigate to a new page with the Item passed as the navigation argument.
I Don't Want The Items
To Line Up Like This
Which happens if I use a grid. Instead I want something like
Name 1, Name Two, Name ThreeName Four, Name Five, Name Six
And clicking on a name fires an event. Each "Name" is a separate item in a collection.
My first thought is that that doesn't sound very metro-esk. That being said, this library has what you want.
WrapPanel - WrapPanel ported from Silverlight. Allows variable sized
controls and wraps to a new line when needed.
There is a post about where it came from plus a sample app located here.
If this isn't quite what you need you should be able to modify it to what you want fairly easily.
Related
Is there a good way to achieve similar dynamic tab in XAML like in Edge browser where tabs are added dynamically? I know that the Pivot can be used for static tabs. More specifically, I need a solution that accounts for situation when there are too many tabs.
An Hoa,
Follow these,
Create a grid with two row definitions.
First row definition is to create controls like
Second row definition is to create a empty layout.
In the first row definition, create a stack panel and add a grid inside it with textblock to display the website name for ex.
Create a + button.
On click of + button, create a same grid with text block and add the control as child element to the stack panel which is present inside the first row definition.
Follow the same for empty layout also which is present in the second row definition.
The Windows Community Toolkit now offer support of this control:
The documentation for this new controls is located here:
https://learn.microsoft.com/en-us/dotnet/api/microsoft.toolkit.uwp.ui.controls.tabview?view=win-comm-toolkit-dotnet-stable
And some code samples are located here:
https://github.com/windows-toolkit/WindowsCommunityToolkit/tree/master/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/TabView
How do I create a Control to input email addresses, similar to how capturing tags on stackoverflow works?
I am using C# and Xaml.
You will need:
TextBox(to show input area where you can type)
Popup(to show suggestions below TextBox like StackOveflow does)
ItemsControl(it goes into Popup, so you can just have collection of items and they will be displayed, note that ItemsPanel should be probably GridView)
Then you will need custom Button, that will be overlaid top of TextBox once tag has been added. You need to calculate how big is the button(width) and fill TextBox with empty spaces, to advance cursor further.
Also you need to control what keys are being pressed.
The effect you are after is probably that you recognize complete e-mail addresses, and render them in a custom way. I would do this by removing the completed addresses from the textbox, and wrap them in a skinned label (or maybe a custom control with a delete button).
The most straightforward way is to implement the textbox as a DockPanel with a border, suggesting that it is a text box. On the left side of your DockPanel, you have a StackPanel where you stack the completed address controls left-to-right. Then add a textbox with DockStyle=Fill to fill up the remainder of the DockPanel. Once you detect an email address is entered, you remove the characters from the textbox and add a matching control to the StackPanel.
There is probably a way to change the textbox contents without losing focus, otherwise you need to fix this though code.
Good luck!
I am now designing a page for a windows 8 app.
the page has 2 parts, the left part will be like a list, when user select one item in the list, the right part will show the content based on the selection.
but I want to select different item in the left will display the different data in the right. For example, maybe select first item in the list, some text blocks will display on the right. select second item , an image will display on the right.
the data in the behind is a class which has some properties. I just want show this properties based on the selection in the list
so how to implement this? anyone has any idea?
thanks!
In the item template, create controls in separate panels for each different data type: text, image, video, etc. Then you can use a converter on each panel to inspect the data that it is bound to and show/hide the panels where appropriate. Depending on your data source, you might be evaluating either the class type or a property that contains an enumerated value that reveals the type, or maybe some more complex evaluation of the state of the class's properties.
One of the templates that comes with Visual Studio Express for Windows 8 supports this list and details view - look at the Split App template.
For more information, see:
http://msdn.microsoft.com/en-us/library/windows/apps/hh738343.aspx
I tried trace(playBtn.text); but only got a undefined,anyone knows?
Edit: Sorry, it's been a while since I've used AS2.
Turns out when it comes to SimpleButton you can't access dynamic text or other objects that are located within them.
You could always create a movieClip and have it have two layers, one that contains the SimpleButton and one that contains a Dynamic Text field that you can modify.
How many times have we seen this type of selector:
List Box Selector http://geekswithblogs.net/images/geekswithblogs_net/dotNETvinz/MoveItemsListBox.jpg
I was just about to start creating this in a WinForms app, when I thought that others may have some ideas for doing this better. We need it to sort - so the right hand list will need up/down buttons. But this seems so old school. I love devexpress components, and was thinking of asking them if they would consider adding a component that handles this functionality with a slick UI.
I am thinking that a graphical representation of the objects, and a graphical representation of the listboxes - that would be a more intuitive way to move items around.
Has anyone seen an open source project like this?
If a CheckListBox won't suffice (and it usually will), then the "modern" approach would be to use a ListView or similar component with a "Transfer" column. Render the button inline in that column, one for each row, so that it only takes one click to move an item from one to the other.
You see this everywhere in Vista, usually with hyperlinks as opposed to buttons. Instead of clicking on an item and then choosing an action, you click the action at the item level.
I wouldn't go overboard with slickness as it can impair functionality, but the dual-listbox screen is definitely old-school.
Also, if there's a very large amount of data to manage, it helps to provide a progressive search at the bottom of one or both lists.
I have done this type of selection using (essentially) a single CheckListBox that displays each item as an image. Part of the image looks like a LED, which is on (bright) if the item is selected or off (dark) if it is not selected.
This works well if you have a reasonable amount of data to select from, and also works well in a multi-column format if you can predict that the options will have reasonably similar lengths.
Allow users to drag items in/out of list 2, and also drag to reorder in list2.
(All items dragged out of list2, and dropped anywhere outside the list, get put back into list 1, in their correct place in the list by alphabetical or natural order.)
You can merge the two list boxes into one with the help of groups (LVGF_GROUPID flag): one group for selected and one for not selected.
You can also implement group membership changes with drag-drop between them. This way single drag-drop can move an item into the other group at the appropriate position, saving most/all of the other buttons.
Additionaly the bottom of each group can have one pseudo item with help text (i.e. "Drag items here to...") that is visible only when relevant.