Add panorama item in selected index - silverlight-4.0

I need to add a panorama item in a selected index like remove ,instead of adding in the last by default.Is it possible to do that

That is perfectly feasible.
First give your panorama control an explicit name (for example x:Name="MyPanorama")
Then use code similar to the following to insert a panorama item at a specific index:
MyPanorama.Items.Insert(0, new PanoramaItem() {Header = "Panoramo 0"});
Hope this helps!

There are two ways of doing this as PanoramaItems can either be set directly or bound through an ItemsSource.
The Panorama Items property is just an ItemsCollection and so support Add(), Clear(), Insert() and Remove() methods which should cover all the scenarios you mention in your question.
Alternatively, if you specify an ItemsSource which is populated with an Enumerable which also implements INotifyPropertyChanged then you could just update the source directly.

Related

How to bind multiple property in xaml for label control in Xamarin

I have two property TotalWeightInGrams and TotalWeightInKiloGrams, i want to bind in label control as following output
string format="{0} ({1} Kgs)"
Easiest way would be to make a new property that returns the string you want and bind to that. This way you don't need to do anything more complicated and can change the formatting in code if needed.

How do I generate a list of checkboxes?

I want to display an unknown number of checkboxes on the page in the form of:
<input type="checkbox"... />
<label for...>
My database table has the information about these checkboxes
Id
Name
For simplicity let's say that Id is just an integer and Name is a colour ("Red", "Green").
How best can I generate these boxes?
My current code is
Model
Public Property Colours As IEnumerable(Of CheckBox)
Public Sub New()
Colours = ...
End Sub
View
#For Each item In Model.Colours
#Html.CheckBox(item.Text, item.Checked)
#Html.Label(item.Text, item.Text)
Next
Also, how are CheckBoxList and CheckBoxField supposed to be used?
I would consider using an extension to generate the check box list, rather than rolling it manually, such as:
CheckBoxListFor
Fabrik.commons
MVC Controls Toolkit
Some colleagues had a problem with previous versions of the MVC Controls Toolkit. That's just hearsay on my part as I was working on something different at the time but just thought I'd mention it in case YMMV.
Re: "how are CheckBoxList and CheckBoxField" supposed to be used, the way I look at it is:
CheckBoxList for a set of related options and you want people to select none, one or possibly more than one
CheckBoxField for when you have a single option which is yes/no or true/false in nature (e.g. a "tick me to unsubscribe" box)
HTH,
Nathan

Create custom SelectedIndices collection from existing SelectedRows collection in datagridview

I need to write a custom collection where it will store the selectedindices of the datagridview. Sine we have SelectedRows colllection property already present in Datagridview. I want to use it and get indices collection so that I can I can create SelectedIndices as a custom property for my Datagridview which is of type collection. Can some one help m eon how will I do it.
For reference;
Selectedindices is a property of Listview provided by microsoft.I want the same with Datagridview. But since I don have that I want to use the SelectedRows property and an create a custom property Selectedindices for my datagridview. It should be of type Collection. PLease suggest if I can do the same .
I do believe that feature is already available, maybe you can find out more by view the link below?
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewselectedrowcollection.aspx
Also a little code sample of how far you got, or what you have tried already always entices other members to be more helpful.

How to show button cell (check box) title in table view, using bindings

I am trying a simple application where I have a mutable array of mutable dictionaries, such as -
NSMutableDictionary *sample6 = [[NSMutableDictionary alloc] initWithObjectsAndKeys:#"title6",#"title",[NSNumber numberWithBool:NO],#"state", nil];
In IB I created a table view with NSButtonCell (check box).
I was able to show checkboxes state (checked or unchecked), using following table column bindings:
Value - ArrayController.arrangedObjects.state
In this case it shows an array of checkboxes with title - "Check" as shown in below screen-shot:
Now my aim is to show checkboxes title using bindings, such that it
gets value from same mutable dictionary from which it is getting its
state.
I tried following binding for button cell but it did not work:
title -> ArrayController.selection.title
I also tried this binding for button cell :
title -> ArrayController.arrangedObjects.title
but it didn't work, it appeared like this after using above binding:
Can any one suggest me which controller key to use and if this is not the correct way to show titles then what is the correct way to do so?
Unfortunately you'll need to write a little code if you want to do it this way. When binding table column values to an array, the table column is handling taking the prototype data cell, setting its values, and "stamping" it in place for each row. The button cell's bindings aren't exposed "through" the table column, so a simple binding won't do it for you.
To Answer Your Question
So. Since only the value binding is exposed, the title must be set manually if you really want the checkbox's title to reflect the value (ie, you really want the checkbox to handle both the check state and displaying the title). To do this, you have to mix bindings with < NSTableDelegateProtocol > . Use the -tableView:willDisplayCell:forTableColumn:row: method to set the cell's -title property to that of the proper object in your array controller's -arrangedObjects array each time you're asked. Mixing bindings and data source / delegate methods is actually quite common for more than the most basic applications, so don't worry that you're doing something dirty. Note: you won't be able to support editing the title by doing this since it's a checkbox.
An Alternative Design
Personally, I'd avoid all that and just add a separate table column for the title. Bind the new column's value to the array controller's arrangedObjects.title and turn off the checkbox button cell's title so only the checkbox itself is displayed. That simplifies the whole thing greatly and allows editing the title.

CheckedListBox VB.Net MultiExtended SelectionMode

I have a CheckedListBox with a few items and I want to allow user to select more than one using arrows keys or mouse clicks combined with shift and ctrl keys so I set SelectionMode property to MultiExtended.
In design time it is not possible I get an error:
value property is not valid.
and if I set it in runtime by doing:
clbEmployees.SelectionMode = SelectionMode.MultiSimple
I get an error too:
CheckedListBox is not compatible with multiple selection.
How could I do this?
It's not supported for the CheckedListBox.
However, I'm fairly sure that you could mimic that functionality in a ListView. Just look at the CheckBoxes and MultiSelect properties of the Listview. As far as I can tell from the documenation those are compatible.
This might be too late, but I just put my solution here; Works perfect for me:
1- Just leave the CheckedListBox Selection mode as "ONE' in property sheet.
2- in your code, loop thru the checked item in your checked Box using the checked item property as following:
For each XX as 'DataTpe' in CheckedListBox.CheckedItems
'Here you assign each checked item to wherever you want to direct to'
Next