Keeping a ListBox in a Grid white

Here you have a very simple standalone XAML file:

<!-- MyListBox.xaml -->
    Title="MainPage" Height="100" Width="525">
                <RowDefinition Height="42"></RowDefinition><!-- THE MAGIC LINE-->

If you open this in Internet Explorer and click the ListBox, then it turns blue. However, if you remove Height="42" from THE MAGIC LINE then the box remains white when you click it. I have two questions:

  1. Why does the presence or absence of Height="42" make a difference?
  2. I would like to make the box permanently white even when THE MAGIC LINE contains an explict declaration of height. How do you do this?


blue color is the default selection color for your listbox. the easiest way to get around is to set the following

            <Style TargetType="{x:Type ListBox}">
                    <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Transparent"/>
                <RowDefinition Height="42"></RowDefinition>
                <!-- THE MAGIC LINE-->

EDIT: your title is something different to the rest of your question. leave a comment if you want something different

Need Your Help

Date conversation error during jaxb marshall on a JPA object using eclipselink

jpa jaxb eclipselink

I stuck on this Date conversation error for quite some time ...

Cell Locking on Save if data has been entered

excel-vba locking vba excel

This is a follow up from this question, Lock Cells after Data Entry. I have progressed from asking that question but encountered more problems so felt I should ask a new question. The workbook is e...