Silverlight Control Learning-ComboBox

Source: Internet
Author: User

In such a case, you need to integrate the checkbox list or the Treeview list in ComboBox to facilitate your selection and provide a good UI experience.

Before starting to process, let's take a look at the basics of ComboBox, that is, writing in XAML (I use the ComboBox control dragged out by blend3, and there will be more redundant code)

1. Basic Application of The ComboBox control

Code

<! -- Test the common ComboBox -->
<ComboBox horizontalalignment = "Left" margin = "120," verticalignment = "TOP" width = "">
<Comboboxitem content = "test data 1"/>
<Comboboxitem content = "Test Data 2"/>
</ComboBox>

<! -- ComboBox Embedded rectangle control -->
<ComboBox margin = "120, 53," verticalalignment = "TOP" horizontalalignment = "Left" width = "">
<Comboboxitem>
<Comboboxitem. content>
<Rectangle width = "200" Height = "30" fill = "blue"/>
</Comboboxitem. content>
</Comboboxitem>

<Comboboxitem>
<Comboboxitem. content>
<Rectangle width = "200" Height = "30" fill = "red"/>
</Comboboxitem. content>
</Comboboxitem>

<Comboboxitem>
<Comboboxitem. content>
<Rectangle width = "200" Height = "30" fill = "green"/>
</Comboboxitem. content>
</Comboboxitem>
</ComboBox>
<! -- ComboBox Embedded checkbox control -->
<ComboBox margin = "365, 53, 120" verticalalignment = "TOP" horizontalalignment = "Left" width = "">
<Comboboxitem>
<Comboboxitem. content>
<Checkbox content = "test data 1"/>
</Comboboxitem. content>
</Comboboxitem>

<Comboboxitem>
<Comboboxitem. content>
<Checkbox content = "Test Data 2"/>
</Comboboxitem. content>
</Comboboxitem>

<Comboboxitem>
<Comboboxitem. content>
<Checkbox content = "Test Data 3"/>
</Comboboxitem. content>
</Comboboxitem>
</ComboBox>

 

 

References:

Silverlight ComboBox tutorial

Learn Silverlight 2 series articles step by step

 

2. ComboBox integrated checkbox list
As you can see in the above XAML code, we can embed the checkbox into the comboboxitem container, but this can only be a test and play, and the specific application is not feasible.
Because there are already some experts on the Internet to write a solution, both from the application perspective and from the perspective of learning.

Multiple-selection ComboBox for Silverlight

This article directly modifies ComboBox and replaces itemspresenter in the original ComboBox control with listboxitem, which is simple and practical.

3. The ellipsis is displayed when the long name is displayed in the text box after the ComboBox is selected.
Seeing this title does not mean I have a solution, haha. After searching for a solution on the Internet for half a day, you can only find the corresponding solution for WPF. However, don't worry. It is suggested that the texttriming attribute added in Silverlight 4 can be processed as in WPF.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.