Skip to main content

Microsoft Silverlight

Answered Question Why can not use DropDownList?RSS Feed

(0)

hiro-tarou
hiro-tarou

Member

Member

12 points

2 Posts

Why can not use DropDownList?

Hello. 

I want to use DropDownList.
I know that you say "Make DropdownList. Silverligt 2 + VS2008 can it."

But, Before considering logic meet specifications, DropDownList's logic must consider.
Thousands, tens of thousands, hundreds of thousands of programmers need spend time to make DropDownList.
This is a big waste.

Why is DropDownList removed, I can't understand.
Please add immediately.

Thank you.

mchlSync
mchlSync

Star

Star

14606 points

2,730 Posts

Silverlight MVP

Re: Why can not use DropDownList?

Since Silverlight 1.0 and 1.1 Alpha, there were no control for Silverlight.

In Silverlight 2 beta1, we got a few standard controls such as Button, Datagrid or etc. but DropDownList is missing in Silverlight 2 beta1. (It is not removed. Dropdwonlist is never a part of Silvelight until now. ) 

In order to save thousands, tens of thousands, hundreds of thousands of programmers' time, you should probably develop one Silverlight custom DropDownlist control and make it opensource. So, we all can use it. :)  

Otherwise, we have to wait some time to get the dropdownlist from Microsoft.  

(If this has answered your question, please click on "Mark as Answer" on this post. Thank you!)

Regards,
Michael Sync
Silverlight MVP

Blog : http://michaelsync.net


hiro-tarou
hiro-tarou

Member

Member

12 points

2 Posts

Answered Question

Re: Why can not use DropDownList?

hello mchlSync.

Thanks to the quick reply.

You say that you are following.
1.Still in the beta stages, DropDownList is not.
2.At this stage, use the program which other person is made.
3.Otherwise, the only wait for the finished product.

OK. I use a program made by other people.
And I wait for finished product.

I hope finished product have a DropDownList.
Please add.This is all.

Thank you.

mamadero2
mamadero2

Member

Member

42 points

28 Posts

Re: Why can not use DropDownList?

 Hi Hiro-tarou,

 

You're right. We all need this control. Scott Guthrie just posted on his blog that it will be included in the final release. Meanwhile you can try the controls out there:

http://blog.seancleaver.com/sean_cleaver/2008/05/combobox-dropdo.html This is a really simple control, but can meet a few scenearios. 

http://www.vectorlight.net/controls/dropdown_list.aspx This is a better control, but complex to use and with a couple of bugs. 

 You can find others, I'll probably post mine if time permits. 

Miguel Madero
Readify Consulting
www.miguelmadero.com
SL Tip of The Day (http://shrinkster.com/10tp)

(Please click on "Mark As Answer", if this has answered your query. Thanks.)

mamadero2
mamadero2

Member

Member

42 points

28 Posts

Dropdownlist Sample

Exapanding on that topic, I tried the first sample and was really simple, I used it as a base and customize it to meet our needs.

The second one was super buggie, really complex and worked great for simple escenarios, but in other's, for example nested dataItems with custom templates or two way binding, it simple crashed and chrashed.

We did one, was really easy to implement, isnot really sexy, but allowed us to work while we get a real one. Here's the code:

<StackPanel>

<TextBlock MouseLeftButtonDown="textBox_MouseLeftButtonDown" x:Name="textBox" Height="18" FontSize="10" Text="ListBox" MinWidth="100"/>

<ListBox x:Name="listBox" ItemsSource="{Binding Valores}" MaxHeight="75" Visibility="Collapsed"

Style="{StaticResource listBoxBaseStyle}" SelectionChanged="listBox_SelectionChanged" DisplayMemberPath="Value"

MouseLeave="listBox_MouseLeave">

<ListBox.ItemContainerStyle>

<Style TargetType="ListBoxItem">

<Setter Property="Background" Value="Transparent"/>

</Style>

</ListBox.ItemContainerStyle>

</ListBox>

</StackPanel>

ublic partial class DropDownList : UserControl

{

public DropDownList()

{

InitializeComponent();

}

public event EventHandler<DataEventArgs<int>> SelectedItemChanged;

#region Cachadoresprivate void textBox_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)

{

ToggleVisibility();

}

private void listBox_MouseLeave(object sender, MouseEventArgs e)

{

listBox.Visibility =
Visibility.Collapsed;

}

private void listBox_SelectionChanged(object sender, SelectionChangedEventArgs e)

{

if (SelectedItemChanged != null)SelectedItemChanged(this, new DataEventArgs<int>(listBox.SelectedItem));

}

listBox.Visibility = Visibility.Collapsed;

}

#endregion

#region
Privadasprivate void ToggleVisibility()

{

if (listBox.Visibility == Visibility.Visible)

listBox.Visibility = Visibility.Collapsed;

else

listBox.Visibility = Visibility.Visible;

}

#endregion

}

Miguel Madero
Readify Consulting
www.miguelmadero.com
SL Tip of The Day (http://shrinkster.com/10tp)

(Please click on "Mark As Answer", if this has answered your query. Thanks.)

deephabsilver
deephabs...

Member

Member

2 points

1 Posts

Re: Dropdownlist Sample


mamadero2
mamadero2

Member

Member

42 points

28 Posts

Re: Dropdownlist Sample

Sorry about that, I didnt post the complete sample. DataEventArgs is really simple and it's used to pass EventArgs than expose only a data parameter. I found this class in the the Mobile Client Software Factory project from Patterns & Practices, but I have seen it used in different projects, has been really useful, we dont want to create different EventHandlers and EventArgs everytime we just need to pass a different type of object.

public class DataEventArgs<T>:EventArgs

{

public T Data { get; private set; } public DataEventArgs(T data)

{

Data = data;

}

}

 

 

Miguel Madero
Readify Consulting
www.miguelmadero.com
SL Tip of The Day (http://shrinkster.com/10tp)

(Please click on "Mark As Answer", if this has answered your query. Thanks.)

SASilver
SASilver

Member

Member

46 points

29 Posts

Re: Dropdownlist Sample

Hi ,

Im trying to create a combobox sample. The code mentioned above kindoff worked but not entirely...Am i missing something ? The dropdown doesnt seem to show up.. I can see the items in the listbox but it does popup ?

Any help? 

Thanks,
SilverUser 

mamadero2
mamadero2

Member

Member

42 points

28 Posts

Re: Dropdownlist Sample

I post the source code an everything on my blog www.miguelmadero.com (Silverlight's DropDownList), you might also want to check the Silverlight Tip of The Day column, it's new and only has 6 posts, but I'm trying to do it daily (except for the weekends).

 

You can get it here

Miguel Madero
Readify Consulting
www.miguelmadero.com
SL Tip of The Day (http://shrinkster.com/10tp)

(Please click on "Mark As Answer", if this has answered your query. Thanks.)

SASilver
SASilver

Member

Member

46 points

29 Posts

Re: Dropdownlist Sample

Thanks a ton !

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities