Silverlight ComboBox/Dropdown List Control

With the Silverlight ComboBox you can implement single item selection that is both simple to setup but powerful to use and expand.

  • Our Popup Dialog Demo uses the ComboBox for template selection.
  • The Rich TextBox Demo demonstrates use of the ComboBox for changing font styles and sizes.
  • This blog shows how to create an editable ComboBox.
A ComboBox

How to Use the Dropdown List Control

To use it on your Silverlight page:

<UserControl x:Class="DropDownList.Page"
    xmlns="http://schemas.microsoft.com/client/2007"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="400" Height="300">
     <Canvas>
          <ComboBox x:Name="testDropDown" Width="200" Height="30" Canvas.Top="10" Canvas.Left="10" SelectionChanged="DropDown_ItemSelected">
               <ComboBoxItem Content="Australia" />
               <ComboBoxItem Content="Canada" />
               <ComboBoxItem Content="China" />
               <ComboBoxItem Content="France" />
               <ComboBoxItem Content="Germany" />
               <ComboBoxItem Content="India" />
               <ComboBoxItem Content="Italy" />
               <ComboBoxItem Content="Japan" />
               <ComboBoxItem Content="Pakistan" />
               <ComboBoxItem Content="Portugal" />
               <ComboBoxItem Content="Republic of Ireland" />
               <ComboBoxItem Content="Russia" />
               <ComboBoxItem Content="Saudi Arabia" />
               <ComboBoxItem Content="Spain" />
               <ComboBoxItem Content="Sweden" />
               <ComboBoxItem Content="United Kingdom" />
               <ComboBoxItem Content="USA" />
          </ComboBox>
               </Canvas>
</UserControl>
 

In your Silverlight C# code behind file you can refer to your dropdown list using countryDropDown. The DropDown has a SelectedItem property which allow you to read the currently selected item.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Liquid;
namespace DropDownList
{
     public partial class Page : UserControl
     {
          private Brush _selectedBrush = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
          private Brush _normalBrush = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
          public Page()
          {
               InitializeComponent();
               testDropDown.SelectedIndex = 2;
          }
          private void DropDown_ItemSelected(object sender, EventArgs e)
          {
               // Process selected index change here
          }
     }
}
 

Your Comments and Questions Answered

 You are not logged in. You need to login to post new messages, if you do not have a login you can register for free!

vitthalgb said:

HI iam working with silverlight.
I want to add three drop down list in the same row for birth date,month and year respectively so,
how can add two drop down list in a same row and column of a grid without space in between

pls help.

Thank you in advance..........have a nice time

04/23/2009 05:35
 
JFloirat said:

Hello Dan,

That's really bad because your control worked better than the one from Microsoft. A major bug that can be found in Silverlight.net forum in the RC0 is actually making this control unusable for many of us out there.

I am stuck on this because I need to use a combobox in a popup and it's not supported. Yours worked fine before RC0!

Since you developped this control, can't you just fix it and put it back?

Cheers.

10/24/2008 08:38
 
dan said:

Hi All,

There are some known bugs in the Dropdownlist, this being one of them and due to the release of Silverlight 2 RC0 which includes a Dropdownlist as standard we will discontinue the Liquid Dropdownlist and concentrate our efforts on our other controls. Thanks!

09/27/2008 10:30
 
vijeshmv said:

Dear Dan,

I used Liquid Dropdownlist in a Liquid dialog box. Once i click the down arrow of dropdown list the list drops down. So far so good. this dropped down list is not getting collapsed if we didnt select any item from the list. It will even remain visible if we close the dialog box where the Liquid dropdown list placed. How can we collapse this list of Liquid dropdown list box?

09/23/2008 09:26
 
garyepaul said:

I'm using your dropdown control and find that it is not part of the tab order. I note your demo some do, some don't. Suggestions?

09/18/2008 04:21
 
dan said:

Hi Jesus,

Sorry, I misunderstood your original question. This is something we have added to the list for future improvements as it is not a simple thing to implement, we will update this page with a timescale soon!

09/02/2008 04:56
 
jesusgarza said:

Hi dan, yes I am also testing the beta. And I found the problem: I am using an observablecollection and was expecting that if I modified the collection the dropdownlist would notice (like the ms listbox). But you have to force a DataBind AFTER you modified the collection.

09/01/2008 03:32
 
dan said:

Hi,

We have had several positive responses from our BETA testers regarding data binding and the tests here have been positive. The next version will be available soon!

09/01/2008 10:37
 
jesusgarza said:

Can anyone confirm that DataBind is working in the beta version?

09/01/2008 10:15
 
dan said:

Hi shabareka,

This is a known issue which is rectified in the next version, which, is available to BETA test, just email us and we'll send you the dll. Thanks!

08/28/2008 11:51
 
shabareka said:

Hi,

I'm trying to databind the dropdownlist control to a collection (I know it's not possible in xaml so I'm trying in the code) but I haven't succeeded yet. Please if anyone have managed to make the databindig, post a working code snippet. Thanks!

                                                                                                                                                                                         Ivo

08/27/2008 12:17
 
dan said:

Hi dlowther,

Thanks very much for your post and example!

08/22/2008 05:21
 
dan said:

Hi Lee,

There are a few problems with the dropsownlist, most of which we are working on at the moment. In terms of the height of the dropdown, this can be controlled using the ExpandedHeight property, however at the moment there is no way to expand it to only the height of 2 or 3 items if there is less than the specified height. Microsoft will be releasing their DropDownList with the final version of Silverlight 2, our control is just a stopgap until the MS one is released.

08/22/2008 05:20
 
dan said:

Hi joer00,

Thanks for reporting this new bug, we will try to get a fix for it in the next version of the library. Thanks!

08/22/2008 05:17
 
t_h_price said:

I have same issue as joer00

This control CRASHES when I click on the drop down box button IF the control is hosted on a sub user control.

Unable to use in current state.

08/20/2008 03:08
 
dlowther said:

Just found my glitch in populating ddl from List or ObservableCollection...

When the properties say "Field" they MEAN it. For example, if you try to set DataKeyField or DataTextField to a property name you will get a "Field not found" exception. However, implementing them as fields in the underlying class will get you cooking.

The following code works, but if you comment out the fields and uncomment out the properties it will throw. Hopefully this helps someone...

Public Class TestObject

     Public Field1 As Integer
     Public Field2 As String

     'Private m_field1 As Integer
     'Public Property Field1() As Integer
     '     Get
     '         Return m_field1
     '     End Get
     '     Set(ByVal value As Integer)
     '         m_field1 = value
     '     End Set
     'End Property

     'Private m_field2 As String
     'Public Property Field2() As String
     '     Get
     '         Return m_field2
     '     End Get
     '     Set(ByVal value As String)
     '         m_field2 = value
     '     End Set
     'End Property

     Public Sub New(ByVal f1 As Integer, ByVal f2 As String)
         Field1 = f1
         Field2 = f2
     End Sub
End Class

Partial Public Class AdminGUI
     Inherits UserControl

     Private m_List As New ObservableCollection(Of TestObject)

Private Sub AdminGUI_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        
         '//populate ddl
         m_List.Clear()
         Dim t As TestObject
         t = New TestObject(1, "Apple")
         m_List.Add(t)
         t = New TestObject(2, "Baby")
         m_List.Add(t)
         t = New TestObject(3, "Cat")
         m_List.Add(t)
         ddl1.DataSource = m_List
         ddl1.DataKeyField = "Field1"
         ddl1.DataTextField = "Field2"
         ddl1.DataBind()
     End Sub
End Class

08/19/2008 07:48
 
Lee.Oades said:

Also, there isn't any real keyboard functionality of the drop down. You can't select an item using the keyboard, nor can you tab away from the control. Tabbing into the control does not focus on the control as you would expect.

08/18/2008 08:21
 
Lee.Oades said:

Apologies if I'm missing something obvious here. These are just the things that I've noticed whilst trying to use this control:

1. I have a drop down with only a couple of items in, however the list that drops down is still about 6 items high. Is there a way so that it only drops down the amount it needs to?

2. I can't seem to set the background colour.

3. It doesn't inherit the Font Size, FontFamily etc from its parent.

4. Not setting a width causes a crash. How can I have the control stretch to the available width?

Thanks,
Lee

08/18/2008 07:45
 
joer00 said:

This control CRASHES when I click on the drop down box button IF the control is hosted on a sub user control.

In my page I pop up another user control which contains the drop down. As soon as I clikc the button it crashes. If i set the star up control of the app to the custom control, than it works fine.

See if you can reproduce and if so please fix this bug, controls are useless if they can only be used on the main control.

08/16/2008 03:56
 
dan said:

Hi,

Thanks for posting this, we have managed to reproduce this and it looks like a bug. We will get this added as a fix for the next version. Thanks!

08/08/2008 11:25
 
rochdi said:

Hi,
I'm using the dropdownlist in a user control.
In the user control constructor and after the InitializeComponent(); method call, I'm setting the dropdownlist DataSource, then the
DataTextField and the DataKeyField. Finaly I'm calling the dropdonwlist DataBind(). WhenI run the application, the dropdownlist is empty. I'm missing something ? thx in advance.


             ddlSort.DataSource = DataContext as List<Entity>;
             ddlSort.DataTextField = "Name";
             ddlSort.DataKeyField = "Id";
             ddlSort.DataBind();

08/05/2008 05:29
 
Wei said:

Hi Bache,

I got a question. The DropDown List can't insert into a DataGrid as a DataGridTemplateColumn.

This is code sinppet
<my:DataGrid x:Name="dg" Width="200" Height="200" AutoGenerateColumns="False">
                                                                <my:DataGrid.Columns>
                                                                                 <my:DataGridTemplateColumn>
                                                                                                 <my:DataGridTemplateColumn.CellTemplate>
                                                                                                                                <DataTemplate>
                                                                                                                                                 <liquid:DropDownList.Items>
                                                                                                                                                                                                <liquid:ListItem Key="1" Value="A"></liquid:ListItem>
                                                                                                                                                                                                <liquid:ListItem Key="2" Value="B"></liquid:ListItem>
                                                                                                                                                                                                <liquid:ListItem Key="2" Value="C"></liquid:ListItem>
                                                                                                                                                                                                <liquid:ListItem Key="4" Value="D"></liquid:ListItem>
                                                                                                                                                                                                <liquid:ListItem Key="5" Value="E"></liquid:ListItem>
                                                                                                                                                                 </liquid:DropDownList.Items>
                                                                                                                                </DataTemplate>
                                                                                                 </my:DataGridTemplateColumn.CellTemplate>
                                                                                 </my:DataGridTemplateColumn>
                                                                                 </my:DataGrid.Columns>
                                 </my:DataGrid>
Could you please help me?

07/30/2008 08:37
 
dan said:

Hi Bache,

Instead of setting the DataContext field, set the DataSource field with your data source:

this.DDLWharf.DataSource = wharfList.OrderBy(item => item.Name);

Hope this helps!

07/09/2008 10:15
 
bache said:

Dan,

I'm trying to databind the Liquid.Dropdownlist to a collection.
After adding an item to a list, I want to order the list alphabetically on the Name property and Databind the ordered list to the control

wharfList.Add(newWharf);
this.DDLWharf.DataContext = wharfList.OrderBy(item => item.Name);
this.DDLWharf.DataKeyField = "WharfId";                            //DDLWharf = DropDownList
this.DDLWharf.DataTextField = "Name";


where "wharfList.OrderBy(item => item.Name);" returns a "System.Linq.OrderedEnumerable"
while dbugging, I see all the ordered(!) items in the "this.DDLWharf.DataContext" but the dropdownlist shows up empty after finishing the code.

Am I forgetting something?

Thanx

Bache

07/08/2008 02:22
 
dan said:

Hello,

The DropDownList can be set so that it is always on top of other controls by ensuring it has a greater Canvas.ZIndex property than other controls and this, of course requires you to be positioning your controls absolutely using a Canvas. Hope this helps!

07/01/2008 04:02
 
kamalleonardo said:

Hello all currently i am using liquid 4.7 version combobox. the problem i am facing is the in the layout when i click at the dropdown it is not overlapping the other controls in form . so please help me regarding this

07/01/2008 07:02
 
dan said:

Hello,

Good point! At the moment you cannot clear the selection which is a bit of an oversight. This is on the fix list for the next version, thanks for reporting this!

06/25/2008 12:10
 
duff_39@hormail.com said:

I know I know, SetSelected(Key) but how can i select nothing? Clear display and selectedvalue.

06/23/2008 01:11
 
duff_39@hormail.com said:

How can i select an item from code?
Excellent work :-)

06/23/2008 01:08
 
dan said:

Hello,

The controls are being updated to Silverlight 2 BETA 2 and will be available very soon, thanks for your patience!

06/07/2008 10:39
 
RobbieM said:

I've got the same problem as harishb17 but with the treeview control. Let us know when you have a fix for this.

06/07/2008 06:52
 
jully123 said:

Hi,

As XAML Databinding is not possible, is there any way to add dynamically liquid:ListItem from database. my wcf service returns the result set.

thanks in advance

05/29/2008 05:26
 
dan said:

Hi Kevin,

This seems to be a bug and has been added to the list of fixes for the next version, thanks for reporting this!

05/29/2008 05:13
 
kevinli said:

Hello,

When calling the DropDown.SetSelected(Key) method, the selected item is not hilighted when the dropdown is clicked. Is there a way to do this?


Thanks,

Kevin

05/29/2008 04:52
 
dan said:

To harishb17:

Where did you get the BETA 2 download?

05/27/2008 05:07
 
dan said:

Hello,

Are you using the style listed on the Visual Customizations page or your own? We are adding easy font customizations for the dropdownlist at the moment and appreciate your patience on this!

05/27/2008 05:06
 
ahmedadly said:

to dan:
im working with beta 1 and when tried to add default drop down list styles to app.xaml and customize it, it gives internal exception and the project can't run, so is there any way to customize the default text font ?

05/24/2008 05:14
 
harishb17 said:

to dan,

ya other projects of mine are working fine in beta 2 if some changes should be done (due to version change)..
your code is also working fine with beta 1 version sucessfully but failed to build it in beta 2 of silverlight.

05/23/2008 08:48
 
dan said:

To harishb17:

We have not seen this error before, do other Silverlight BETA 2 demos work on your machine? Have you managed to download and use any of our projects?

05/19/2008 12:09
 
dan said:

To Dipali Shah:

The controls do not expire after a certain time and are free to use on 1 website for your company, if you want to use it on more than one website or want to re-distribute the dll then you will need a license.

05/19/2008 12:05
 
harishb17 said:

hi,
I am working on silver light 2.0 beta 2 version,
when i am using this dll in my application i am getting the following error..
-------
The "ValidateXaml" task failed unexpectedly.
System.TypeLoadException: Derived method 'OnApplyTemplate' in type 'Liquid.LiquidControl' from assembly 'Liquid, Version=4.4.0.17600, Culture=neutral, PublicKeyToken=null' cannot reduce access.
    at System.Reflection.Assembly._GetType(String name, Boolean throwOnError, Boolean ignoreCase)
    at System.Reflection.Assembly.GetType(String name)
    at MS.Internal.Xaml.Schema.ClrNamespace.SearchAssembliesForShortName(String shortName)
    at MS.Internal.Xaml.Schema.ClrNamespace.TryGetXamlType(String xamlName, Assembly localAssembly, XamlType& xamlType)
    at MS.Internal.Xaml.Schema.ClrNamespace.GetXamlType(String typeName, XamlTypeSearchSettings searchSettings, Assembly localAssembly, Boolean throwOnError)
    at MS.Internal.Xaml.XamlContext.GetXamlType(String prefix, String name, XamlTypeSearchSettings searchSettings, XamlNamespace& xamlNs, Boolean throwOnError)
    at MS.Internal.Xaml.Parser.XamlScanner.ReadObjectElement(XamlName name, Boolean isEmptyTag)
    at MS.Internal.Xaml.Parser.XamlScanner.ReadElement()
    at MS.Internal.Xaml.Parser.XamlScanner.DoXmlRead()
    at MS.Internal.Xaml.Parser.XamlScanner.Read()
    at MS.Internal.Xaml.Parser.XamlPullParser.d__23.MoveNext()
    at MS.Internal.Xaml.Parser.XamlPullParser.d__7.MoveNext()
    at MS.Internal.Xaml.Parser.XamlPullParser.d__39.MoveNext()
    at MS.Internal.Xaml.Parser.XamlPullParser.d__23.MoveNext()
    at MS.Internal.Xaml.Parser.XamlPullParser.d__7.MoveNext()
    at MS.Internal.Xaml.Parser.XamlPullParser.d__0.MoveNext()
    at MS.Internal.Xaml.TextReaderEnumerator.MoveNext()
    at MS.Internal.Xaml.XamlTextReader.Read()
    at MS.MarkupCompiler.ValidationPass.ValidateXaml(String fileName, Assembly[] assemblies, Assembly callingAssembly, TaskLoggingHelper log, Boolean shouldThrow)
    at Microsoft.Silverlight.Build.Tasks.ValidateXaml.XamlValidator.Execute()
    at Microsoft.Silverlight.Build.Tasks.ValidateXaml.XamlValidator.Execute()
    at Microsoft.Silverlight.Build.Tasks.ValidateXaml.Execute()
    at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult) SilverlightApplication2
---


please help out.

05/17/2008 02:17
 
Dipali Shah said:

Is this controls are like trial version and expired after some time? Becoz we don't have code of this and if i want to use it in live project that so need to confirm.

05/17/2008 12:10
 
Dipali Shah said:

Hi,

It is possible databinding throu code in this ddl....

ThanX

05/16/2008 10:30
 
dan said:

Hello,

It is not possible to set the background at the moment, we are looking to add this feature in the next version. Thanks!

05/14/2008 12:03
 
kevinli said:

Hi,

How do you change the background colour of the DropDownList?

Thx

05/13/2008 07:51
 
dan said:

Hello,

Not at this time, databinding is being looked at at the moment, we will update this page when we are nearer a solution!

05/12/2008 05:33
 
kevinli said:

Dan,

Can databinding be done in the code behind?


Thanks.

05/09/2008 05:55
 
dan said:

Hello,

XAML Databinding is not possible at the moment in the DropDownList, we are looking at implementing this soon!

05/09/2008 05:47
 
kevinli said:

Hi,

Does anyone know how to bind a DropDownList in XAML? Thanks.

05/09/2008 02:22
 
dan said:

Hello,

This is a good request and one we will add to the improvements list for the next version. Thanks!

05/09/2008 12:12
 
omnius said:

Is there a way to set the direction the list opens in? When I have the DropDownList near the bottom of the browser window, the open list isn't visible because it runs out of the visible area. In this situation the list needs to open above rather than below.

05/08/2008 10:11
 
dan said:

Hello,

I think the bit you are missing is where you give the style (in the App.xaml file) a name (x:Name="testStyle") and then when you declare the control in xaml you should include the style attribute (style="{StaticResource testStyle}"). For more information There is a very good article on styles..

04/29/2008 09:21
 
thumphries said:

I've tried downloading the default style and changing them, but it does seem to effect the look of the dropdownlist.
Basicly, I've copied the default styles into the app.xaml file and made changes to them. Am I missing a step?

04/29/2008 07:49
 
dan said:

Hello,

The latest release 4.4 addresses the issue of controlling the formatting of the selected item, see the example above.

04/29/2008 03:44
 
chmcabee1 said:

Hi,

I have not had any success setting the font family and size of the displayed text after a list item has been selected in a DropDownList (i.e. the control is in a collapsed state). Although, using styles, I can set the style attributes of the list items in an expanded DropDownList. Is this a bug or do you have some working examples?

Any help would be appreciated.

04/28/2008 08:18
 
dan said:

Hello,

Apologies for this, there seems se be some missing styles from the page which I have now fixed. Basically the DropDownList uses a standard ScrollViewer which is referred to in the styles see the line:

Style="{StaticResource scrollViewerStyle}"

You can remove this if you do not want rounded corners else you will need to copy these styles too. Please refer to the Visual Customizations page for the correct styles.

04/21/2008 04:32
 
ndsit said:

Trying to use styles with the dropdown box, but when I add the sample you have in visual customisations the whole xaml page doesn't show in VS2008 designer. Do you have any working examples on howto change the look and feel of the dropdown list ?

Nathan

04/20/2008 06:36
 
Scott said:

ok heres an easy extension method

public static void SetSelectedByIndex(this Liquid.DropDownList list, int index)
{
         if (list.Items.Count > 0 && list.Items.Count >= index)
         {
                 Liquid.ListItem item = list.Items[index];
                 list.SetSelected(item.Key);
         }
}

pop it in a static class then use it like

lstSelectContentBlock.SetSelectedByIndex(0);

easy :)

04/16/2008 09:57
 
dan said:

Hi,

We don't have any samples of using the dropdown in the DataGrid, first guesses are that it won't be possible but we will test and report back.

04/10/2008 06:26
 
Richie Scott said:

Do you have any samples on how I could use this in a DataGrid? Is it possible?

04/07/2008 02:37
 
dan said:

Hello,

Yes, one of the main fixes with this version is an over-haul of the rendering to bring them in-line with Microsoft's own control library and as a result they now work in the XAML preview. Enjoy using them:-)

04/06/2008 07:55
 
Azetoth said:

It seems that version (4.2) correct all the problems that I has. (the demo page works fine now and no more exception are thrown).

Thx.

04/06/2008 06:33
 
George said:

Hey guys,

when I open a xaml file in Blend 2.5, the drop-down control could not be rendered correctly on the design surface. Any fix for that?

03/26/2008 12:24
 
enthelis said:

Hello,
Thank you for the quick reply. I'm gonna post part of the code I'm using. Hope this help.

public void PopulateDropDownList(DropDownList myList)
{
myList.Items.Clear();
myList.Items.Add(new liquid.ListItem("0", "All"));
myList.SetSelected("0");

foreach (MyObject obj in List)
{
myList.Items.Add(new liquid.ListItem(obj.ID, obj.Name));
}
}

This is the method I'm using to populate the drop down list. after calling this method I set the popup of the drop down list : myList.SetPopup(myPopup); I call this functions everytime I want to change the values in the Drop down list. Hope this helps. Thank you once again.

03/20/2008 07:00
 
dan said:

Hello,

This sounds like a bug, we have unsuccessfully tried to replicate it here. Do you have any sample code that demonstrates the problem?

03/20/2008 06:21
 
enthelis said:

Hello,
I'm using a dropDownList version 4.1 in a silverlight 2.0 project. The problem is when I populate the drop down list for the second time and I select an item from the list. This action makes my drop down to set the scroll bar outside of the area of the list and it shows an empty space below my last item. The moment I press a scroll bar button everything seems to work perfect. There aren't any more empty spaces and the scrollbar is in it's normal position. Could you please tell me if this is a bug or if I'm doing something wrong. Thank you.

03/20/2008 03:28
 
enthelis said:

Hello,
I'm using a dropDownList version 4.1 in a silverlight 2.0 project. The problem is when I populate the drop down list for the second time and I select an item from the list. This action makes my drop down to set the scroll bar outside of the area of the list and it shows an empty space below my last item. The moment I press a scroll bar button everything seems to work perfect. There aren't any more empty spaces and the scrollbar is in it's normal position. Could you please tell me if this is a bug or if I'm doing something wrong. Thank you.

03/20/2008 03:11
 
Azetoth said:

I'm definitly sure the problem in on my system, because the Form Controls Demo on this site doesn't work too. (Nothing is visible under the text description). The odd thing is that every sample on silverlight 2 beta that I tried (like http://silverlight.net/Samples/2b1/SilverlightControls/run/default.html) works fine. I 'll let you known if I found something.

Thanx

03/17/2008 02:43
 
dan said:

Hello,

We have been unable to replicate this problem, if you like can you zip up and email the complete project to us at: dan@vectorlight.net?

03/17/2008 01:55
 
Azetoth said:

Thanx for this quick answer. but there is still an issue. There is probably something wrong with my config.

VS2008 - Silverlight 2 Beta - Silverlight Tools Beta 1 for Visual Studio 2008 - Control For Silverlight v 4.1

I loaded the demo project found in zip file. When I launch it, it throw this kind of exception. (I didn't made any change in project)

Additional information: System.Windows.Markup.XamlParseException: AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 9 Position: 196]
at MS.Internal.XcpImports.Control_InitializeFromXaml(Control control, String xamlString, Boolean createNamescope)
at System.Windows.Controls.Control.InitializeFromXaml(String xaml)
at Liquid.Core.Controls.LiquidControl..ctor()
at Liquid.Core.Controls.DataboundLiquidControl..ctor()
at Liquid.Core.Controls.DropDownList..ctor() [Line: 0 Position: 2]

03/15/2008 09:30
 
dan said:

Hello,

This is due to the styles not being copied to your App.xaml file. The styles can be found in the downloaded zip file of version 4.1, you need to ensure these files are in your project App.xaml. If you need an example project then you can download the form controls demo project.

03/15/2008 07:34
 
Azetoth said:

I tried a simple solution with a copy/paste of sample from this page, but i have an exeption on InitializeComponent();
I copied the liquid.dll to ClientBin too.

Additional information: System.Windows.Markup.XamlParseException: System.Windows.Markup.XamlParseExcepion: Cannot find a Resource with that Name/Key [Line: 7 Position: 81]
at MS.Internal.XcpImports.Control_InitializeFromXaml(Control control, String xamlString, Boolean createNamescope)
at System.Windows.Controls.Control.InitializeFromXaml(String xaml)
at Liquid.Core.Controls.LiquidControl..ctor()
at Liquid.Core.Controls.ListItem..ctor() [Line: 0 Position: 2]
at MS.Internal.XcpImports.Control_InitializeFromXaml(Control control, String xamlString, Boolean createNamescope)
at System.Windows.Controls.Control.InitializeFromXaml(String xaml)
at Liquid.Core.Controls.LiquidControl..ctor()
at Liquid.Core.Controls.DataboundLiquidControl..ctor()
at Liquid.Core.Controls.DropDownList..ctor() [Line: 4522085 Position: 6488184]

03/15/2008 05:41
 
dan said:

Hi Deraldo,

To set the selected item you can use the SetSelected() method of your dropdownlist. This method requires you to pass the Key for the item you want to select. So, taking the example above you would use:

testDropDown.SetSelected("9");

This selects "Item 9" in the dropdownlist. It is important you call this method after you have populated your control with items. Hope this helps.

02/28/2008 01:11
 
Deraldo said:

Hi.
If I have the dropdownlist populated and get some values from database, how could I select the apropriate value in the ddl control? I tried with selectedvalue but it is readonly.

thx in advance.

02/28/2008 12:54
 
dan said:

Hello,

The nature of z-depth calculations in Silverlight make it not possible to have two Canvas objects next to each other and have child controls of one canvas overlap another. The solution is to put the DropDownList ListBox on the Canvas that contains these two canvas' i.e. the parent canvas of the canvas your DropDownList control is on. That way you will be able to specify the Canvas.ZIndex property.

Unfortunately this is the way Silverlight handles the depth of visual elements and controls. Let me know if you need more help with this and I can do a tutorial page about Siverlight control rendering order (z-indexing) to help as I know it can be quite confusing.

02/14/2008 09:59
 
Deraldo said:

Hi Dan. Nice work!
How could I put the dropdownlist associated listbox in top of others components? I have a dropdownlist inside one canvas that has another canvas very closed. the listbox shows behind this adjacent canvas.

thx in advance.

02/14/2008 07:14
 
dan said:

Hello,

There is a bug with the dropdown list and selecting a default item. This is being fixed at the moment and will be available in version 2.7 along with other improvements.

02/06/2008 12:52
 
prejeshvp said:

ho to customize the intial text(select an item) ie present in dropdownlist

02/06/2008 03:36
 
dan said:

Having investigated the problem you have with duplicated entries, we have found that when adding InputOption objects to the Items collection of the drop down you must ensure the ID property is unique, otherwise you will encounter problems like you have been having.

For simplicity, in the example above the PopulateDropDown() method takes a List collection and populates the Items collection using each string as both the ID and Label for the Item. In a real-life application the ID would be unique, in your application you can have duiplicate Label values in the collection but the ID values must be unique.

01/15/2008 02:26
 
dan said:

Hi,

Regarding your last two posts, there is no way (yet) to customize the Brush or the font for this control, visual customizations are currently being implemented and will be included as part of Version 2.3.

The duplication issue you are having is a new issue, thanks for raising that it has been added to the bug list for the next version.

01/15/2008 02:11
 
a801227 said:

Duplicated list entries will cause the list to be truncated where the duplication occurs.
Suppose I have 10 list entries > 1,2,3,4,5,5,6,7,8,9 > Only 1,2,3,4,5 will appear in the drop down box. Known issue?

01/15/2008 02:02
 
a801227 said:

Is it possible to customize the Brush for the background, foreground? How about changing the font size of the options? I don't see any properties exposed. There is a SetSkin(string xaml) function but there are no samples on how to use that.

01/15/2008 12:00
 
prejeshvp said:

thanks dan its working

01/11/2008 03:09
 
dan said:

Is the latest version of the Liquid.dll in your ClientBin folder? This is essential for fixing the missing images errors you are getting.

01/10/2008 08:14
 
prejeshvp said:

i m getting an download error, i guess it is for image in that dropdownlist its missing...other stuffs are working..thanks for earlier help

01/10/2008 04:31
 
dan said:

I've created a quick example of creating a drop down list populated with countries above, ensure you have the latest version 2.1 of the Liquid.dll from the downloads page before running the above example. I will continue to create more examples for the other controls where time permits.

01/10/2008 03:47
 
prejeshvp said:

can u give some codes for using it?

01/10/2008 12:44

Silverlight 3

Latest News

  • Silverlight 2 Controls V5.2.1 Released
    Jul, 03 2009

    After several months since the last release we have implemented many fixes to the controls library. The Rich TextBox has been improved with Links...

  • Silverlight 3 BETA Controls Released
    Mar, 30 2009

    As Silverlight 3 BETA is available now to test we thought we would present the Liquid Controls library for Silverlight 3. This BETA...

Silverlight 2 Controls

  • Rich TextBox

    Create and edit rich content with this slick and expandable Rich TextBox...

  • TreeView

    This easy to use TreeView comes with drag and drop, sorting, searching and much more...

  • Context Menu

    You too can have cool popup context menus in your Silverlight applications...

  • Resizable Dialog

    Draggable and resizable popup dialogs are what serious Silverlight developers need...

  • Spell Checker

    Real-time spell checking in Silverlight? We did it first here...