views:

397

answers:

1

I have a Listview like the Address book in outlook. and it looks like

   Name             Phone      
----------------------------
 Everyone
 User1             12345 
 User2             54321
 User3             98765

I need the row "Everyone" to Bold letters. And my listview is

<ListView Name="lvContacts"
          Grid.Row="2" Grid.Column="0"   
          VerticalAlignment="Stretch" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch"
          SelectionMode="Multiple" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto"
          ItemsSource="{Binding AddressList}" >
            <ListView.View>
                <GridView x:Name="gdvContacts">
                    <GridViewColumn Width="160" Header="Name" DisplayMemberBinding="{Binding Path=Name }"/>
                    <GridViewColumn Width="150" Header="Cell Phone" DisplayMemberBinding="{Binding Path=CellPhone}"/>
                </GridView>
            </ListView.View>
        </ListView>

How can I do this?

+1  A: 

Try this:

<ListView Name="lvContacts"
       Grid.Row="2" Grid.Column="0"   
       VerticalAlignment="Stretch" HorizontalAlignment="Stretch"     
       HorizontalContentAlignment="Stretch"
       SelectionMode="Multiple" ScrollViewer.VerticalScrollBarVisibility="Auto" 
       ScrollViewer.HorizontalScrollBarVisibility="Auto"
       ItemsSource="{Binding AddressList}" >

    <ListView.ItemContainerStyle> 
        <Style TargetType="{x:Type ListViewItem}"> 
            <Style.Triggers> 
                <DataTrigger Binding="{Binding Path=Name}" Value="Everyone"> 
                    <Setter Property="FontWeight" Value="Bold" /> 
                </DataTrigger> 
            </Style.Triggers> 
        </Style> 
    </ListView.ItemContainerStyle> 
    ...
David Elizondo
Thanks, it works
Sauron