Click here to Skip to main content
15,898,036 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I've changed the listbox foreground color to default application background color so I get:
http://i.imgur.com/pVeaTXI.jpg[^]
which is fine but when I select any element I get white background/foreground(or whatever it is):
http://i.imgur.com/xVy257a.jpg[^]

How can I change this so I will have the same default color in the second case?

It is a windows store app

Edit:Added code as requested (listbox is at the end)
XML
<Page
    x:Name="pageRoot"
    x:Class="ExchangeRate2.MainPage"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:ExchangeRate2"
    xmlns:common="using:ExchangeRate2.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">

    <Page.Resources>
        <!-- TODO: Delete this line if the key AppName is declared in App.xaml -->
        <x:String x:Key="AppName">My Application</x:String>
    </Page.Resources>

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid removed="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.ChildrenTransitions>
            <TransitionCollection>
                <EntranceThemeTransition/>
            </TransitionCollection>
        </Grid.ChildrenTransitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Margin="39,59,39,0" Command="{Binding NavigationHelper.GoBackCommand, ElementName=pageRoot}"
                        Style="{StaticResource NavigationBackButtonNormalStyle}"
                        VerticalAlignment="Top"
                        AutomationProperties.Name="Back"
                        AutomationProperties.AutomationId="BackButton"
                        AutomationProperties.ItemType="Navigation Button"/>
            <TextBlock x:Name="pageTitle" Text="{StaticResource AppName}" Style="{StaticResource HeaderTextBlockStyle}" Grid.Column="1" 
                        IsHitTestVisible="false" TextWrapping="NoWrap" VerticalAlignment="Bottom" Margin="0,0,30,40"/>
        </Grid>
        <StackPanel HorizontalAlignment="Left" Height="541" Margin="521,28,0,0" Grid.Row="1" VerticalAlignment="Top" Width="684">
            <Grid Height="100">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="300"/>
                    <ColumnDefinition Width="200"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Border Grid.Column="0" Grid.Row="1">
                    <TextBlock Text="Value Name" FontSize="30" VerticalAlignment="Center" TextAlignment="Center" />
                </Border>
                <Border Grid.Column="1" Grid.Row="1">
                    <TextBlock Text="Value Code" FontSize="30" VerticalAlignment="Center" TextAlignment="Center" />
                </Border>
                <Border Grid.Column="2" Grid.Row="1">
                    <TextBlock Text="Exchange Rate" FontSize="30" VerticalAlignment="Center" TextAlignment="Center" />
                </Border>
            </Grid>
                <ItemsControl ItemsSource="{Binding Data2}" Height="175">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Grid Height="300" Width="453">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="300"/>
                                    <ColumnDefinition Width="200"/>
                                    <ColumnDefinition/>
                                </Grid.ColumnDefinitions>
                                <Grid.Resources>
                                    <Style TargetType="TextBlock">
                                        <Setter Property="Margin" Value="5,0"/>
                                    </Style>
                                </Grid.Resources>
                                <TextBlock Grid.Column="0" Text="bfgbgfbgfbgfbgf" />
                                <TextBlock Grid.Column="1" Text="{Binding ValueCode}" />
                                <TextBlock Grid.Column="2" Text="{Binding ExchangeRate}" />
                            </Grid>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
        </StackPanel>
        <Button x:Name="GetExchRate_button" Content="GetExchangeRate" HorizontalAlignment="Left" Margin="346,62,0,0" Grid.Row="1" VerticalAlignment="Top" Click="GetExchRate_button_Click"/>
        <TextBox x:Name="textbox1" HorizontalAlignment="Left" Margin="342,278,0,0" Grid.Row="1" TextWrapping="Wrap" Text="{Binding ValueCode}" VerticalAlignment="Top"/>
        <ListBox x:Name="listbox" HorizontalAlignment="Left" Height="205" Margin="69,224,0,0" Grid.Row="1" VerticalAlignment="Top" Width="187" removed="{x:Null}" BorderBrush="Transparent">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Margin="10">
                        <TextBlock Text="{Binding ValueName}"/>
                        <TextBlock Text="{Binding ValueCode}"/>
                        <TextBlock Text="{Binding ExchangeRate}"/>
                    </StackPanel>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
    </Grid>
</Page>
Posted
Updated 22-Dec-14 4:58am
v2
Comments
vijay chander 21-Dec-14 23:39pm    
Can you post the code so that we can get an idea.

try selectedindexchanged=null or same color as you mentioned in the first image

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900