Feed on
Posts
Comments

Posts Tagged ‘ListBox’

ItemContainerStyle is the style that is applied to the dataitems.  In the figure below we see the default style that comes with the listbox on the left and style that is customized on the right.
 
Here are the steps
1. Get the default style for the ListBoxItem from generic.xaml using reflector or from the sdk
2. Remove all [...]

Read Full Post »

There are places in which we want to show the details of an Item(ex. listboxitem) when it selected. As it is not easy to get the actual item(listbox item), we have to add some code to get a handle to the control when the controls are getting loaded
lets say we have this XAML

<UserControl x:Class=”SilverlightApplication10.Page”
    xmlns=”http://schemas.microsoft.com/client/2007“
    [...]

Read Full Post »

A couple of posts back we saw how to create a simple yet functional expander control. this sample shows how to use one of those in listbox. we will replace the listboxitem template with our expander control.
see a demo

source is available here

Read Full Post »

Here is a declaration for listbox, ItemsSource set in code behind to a collection of objects.
Datatemplate in the following sample binds FirstName property of the object to the content of the button
<ListBox x:Name=”listbox1″ ItemTemplate=”{StaticResource dt}”/>
and in the resources section we will have a datatemplate declared like this
  <UserControl.Resources>
        <DataTemplate x:Key=”dt”>
            <Button  MouseLeftButtonDown=”Button_MouseLeftButtonDown”
                    Content=”{Binding FirstName}”></Button>
        </DataTemplate>
    [...]

Read Full Post »