PDA

View Full Version : WPF Multiple Select Treeview



mani85
September 3rd, 2007, 06:15 AM
hi,

i am trying to make a Multiselect tree view using Ctrl+ Mouse key. i have created the tree view dynamically. Do yu have any sample source code to create a multiselect treeview for my scenario.

Thanks in Advance,
Mani

kirupa
September 7th, 2007, 01:49 AM
Hi Mani,
Sorry for the delay in responding to your question. I cannot think of an easy way to do this, for Treeview isn't based on a control that supports multiple-select such as Listbox. Have you considered using checkboxes as leaves/values to simulate multiple selecting?

Cheers!
Kirupa :)

nite21
April 19th, 2008, 12:53 PM
Hi Mani,
Sorry for the delay in responding to your question. I cannot think of an easy way to do this, for Treeview isn't based on a control that supports multiple-select such as Listbox. Have you considered using checkboxes as leaves/values to simulate multiple selecting?

Cheers!
Kirupa :)


hi kirupa
how to validate duplicate usernames so that unique values get entered in the listbox

kirupa
April 19th, 2008, 02:19 PM
You can use a Dictionary to store all of the current values, and when a new value is entered, check your Dictionary to make sure that value isn't still there :)

nite21
April 20th, 2008, 01:48 AM
You can use a Dictionary to store all of the current values, and when a new value is entered, check your Dictionary to make sure that value isn't still there :)


hi kirupa thanks for replying
here is the code



var my_list:mx.controls.List;
user.text = "";
btn1.onPress = function ()
{
if (user.text == "")
{
error = "please enter name";
}

if (user.text != "")
{
for(i=0;i<my_lb.length;i++)
{
nite=my_lb.getItemAt(i).label;
trace(nite);

}
if(user.text == nite)
{
trace("Duplicate Values");
}
else
{
trace("OK");
my_lb.addItem(user.text);
}
user.text = ""
error = "";
}

}

btn2.onPress = function () {
//mydata = my_lb.length;
var myA=new Array();
myA=[];

for(i=0;i<my_lb.length;i++)
{
//trace(my_lb.getItemAt(i).label);
myA.push(my_lb.getItemAt(i).label);
//trace(myA);
}

mydata=myA;

}



btn3.onPress=function()
{
if (my_lb.selectedIndex != undefined)
{
my_lb.removeItemAt(my_lb.selectedIndex);
error="";
}
else
{
error = "please select something in list";
}

}

nite21
April 20th, 2008, 01:49 AM
kirupa when i validate nite saw nite it doesnt validate me
but when i validate nite nite it validates