Change Foreground Color

2 posts, 0 answers
  1. Tony
    Tony avatar
    24 posts
    Member since:
    Nov 2011

    Posted 19 Jan 2012 Link to this post

    How do i change the foreground text color in the RadBreadCrumb? When I set the Foreground property to White (see below), it works fine in the designer. But when I run the application, the breadcrumb text is always black. My Xaml is simple:

    <telerik:RadBreadcrumb x:Name="bcCrumbs" VerticalAlignment="Top" 
                Header="{Binding Root}" Width="250" 
                Grid.Column="2"
                HorizontalAlignment="Right"
                CurrentItemChanged="RadBreadcrumb_CurrentItemChanged"  
                IsIconVisible="False" IsHistoryEnabled="True" IsTextSearchEnabled="False" IsTextModeEnabled="False"  
                ItemsSource="{Binding Root.Children}"
                TextModePath="Path" BorderThickness="0" Foreground="White" Background="Yellow"
                HierarchicalItemsSource="Children" HeaderMemberPath="DisplayText"  HierarchicalMemberPath="DisplayText">
    </telerik:RadBreadcrumb>
     The only other thing to note is I do set the theme to Metro in the App constructor:
    StyleManager.ApplicationTheme = new MetroTheme();



  2. Zarko
    Admin
    Zarko avatar
    755 posts

    Posted 24 Jan 2012 Link to this post

    Hello,
    Thank you for the feedback. There seems to be problem with the foreground property of the RadBreadcrumb.
    There are two possible workarounds:
    - the first one is to change the default foreground color of the Metro theme like this:
    StyleManager.ApplicationTheme = new MetroTheme();
    MetroColors.PaletteInstance.MarkerColor = Colors.White;
    Note if you do this all metro foregrounds will become white so you'll have to test this.
    - and the second one is to use actual ItemTemplate instead of the HierarchicalMemberPath, HeaderMemberPath and HierarchicalItemsSource and set the foreground there like this:
    <telerik:RadBreadcrumb x:Name="bcCrumbs"
                                    ...>
        <telerik:RadBreadcrumb.ItemTemplate>
            <telerik:HierarchicalDataTemplate ItemsSource="{Binding Children}">
                <telerik:HierarchicalDataTemplate.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Foreground="Purple" Text="{Binding DisplayText}" />
                    </DataTemplate>
                </telerik:HierarchicalDataTemplate.ItemTemplate>
                <TextBlock Foreground="White" Text="{Binding DisplayText}" />
            </telerik:HierarchicalDataTemplate>
        </telerik:RadBreadcrumb.ItemTemplate>
    </telerik:RadBreadcrumb>

    I've logged this issue in our PITS  under the name "The Foreground property doesn't work" and it'll be ready for voting and tracking tomorrow the latest. I've also updated your telerik account.
    I've attached a sample project that demonstrates the second workaround so could you please examine it and if you have more questions feel free to ask.

    All the best,
    Zarko
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
Back to Top