Nested Checkboxes in a ListBox in Silverlight 4 - silverlight-4.0

With Silverlight 4 as the technology platform, using an ObservableCollection as the ItemSource, assuming each item in the ObservableCollection has a property called SubLayers which contains children, what would the ListBox.ItemTemplate be such that the checkboxes in the listbox are nested in accordance with the ObservableCollection contents?

You can accomplish the same requirement with treeview using style sheet.

Related

Xamarin bind to another element from within a listview itemtemplate

I have a list view, with an itemtemplate, datatemplate, viewcell etc. In there I have a bunch of controls binding to the item properties. That all works great, but I do not seem to be able to reference another element on the same page within it, for example,
{Binding Path=MyProperty, Source={Reference AnotherElement}}
Even though I have another element on the same page called 'AnotherElement' that exposes 'MyProperty' and this exact binding works in other areas on the same page, I cannot get any bindings to refer to another element from within the listview itemtemplate.
Any ideas what I'm doing wrong?
Since you are in a listview item template the Xamarin Forms ListView needs a binding context to map the binding with by that i mean it needs the reference of the Source of its binding context you can provide that using the ListViews x:Name property
Give your list view a name:
<ListView x:Name="myList"...>
Then use its binding context as Source
Path=BindingContext.MyProperty, Source={x:Reference myList}}"/>

SemanticZoom without GridView

I'd like to know, how I can implement my own SemanticZoom WITHOUT GridView control.
I have my own custom controls on the mainpage but a structure similar to a grouped GridView and I want to open details after the user makes a zoom-gesture on a group.
But it seems that the SemanticZoom control only works together with the GridView.
Any ideas?
cheers, Thomas
The controls contained inside the SemanticZoom control can be any control that implements the ISemanticZoomInformation interface - ISemanticZoomInformation interface
Simple example at Semantic Zoom only supports GridView and ListView?

create a user control Treeview in metro

There's no treeview control in win rt, anyone know how to create a treeview user control? Any control should I inheritant?
Navigation by hierarchical structure is better visualize with ListView in winrt. You need to display a list of nodes, when user touches a node, it should display ListView with sub nodes and button back.
But you can implement own control TreeView (that looks like WPF or Silverlight TreeView). You need to derive from ListBox and ListBoxItem controls, and add indent for subnodes at PrepareContainerForItemOverride() method.

Windows Store App: Should I use ListBox or ListView?

I have a question about Windows Store Apps:
what is the difference between the:
ListBox
ListView
i want to have a list with different TextBlocks
The more Windows-8 App style control is the ListView. It has built-in functionality for things like scrolling. The ListBox does basically the same things except it doesn't have the nice scrolling functionality.
See here for a more in-depth treatment.

how to disable the default selection in listview when you navigate to it

I have two list views in a scene (listview1 and listview2, contents of listview2 depends on the selecteditem on listview1) and when I navigate to the scene I want the first item in listview1 to be selected and the details be displayed in the other listview (listview2) but I do not want any item in the listView2 selected by default.
What i am observing is that the first item in listView2 is also selected and that is causing selectionchanged event to be triggered for listview2 (which I want to be triggered only if the user explicitly selects it)
No need for workarounds.
Just set IsSynchronizedWithCurrentItem="False" in your ListView.
This also works for GridViews.
selectionchanged events will be triggered and cannot be stopped. But it can be bypassed (using a flag) in the code behind.
If ListView is bound to CollectionViewSource, CollectionViewSource sets the first items as selected.
If ListView is bound to regular Collection, no items will be selected automatically.
This is because you set the event handler of list view 1 & 2 by XAML, maybe.
If you set the data source and selected item first, then,
set the event handler by your code behind, it works well, I think.