Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6338609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:28:48+00:00 2026-05-24T19:28:48+00:00

I am in the process of making a text editor, I am trying to

  • 0

I am in the process of making a text editor, I am trying to set up some functionality so that the user can select a colour from a combo box and that will change the colour of the text. Right now my combo box is being loaded with the system colours in xml using a resource like so

<ToolBarTray.Resources>
<ObjectDataProvider MethodName="GetType" ObjectType="{x:Type sys:Type}" x:Key="colorsTypeOdp">
<ObjectDataProvider.MethodParameters>
<sys:String>System.Windows.Media.Colors, PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</sys:String>
 </ObjectDataProvider.MethodParameters>
 </ObjectDataProvider>

<ObjectDataProvider ObjectInstance="{StaticResource colorsTypeOdp}"    MethodName="GetProperties" x:Key="colorPropertiesOdp">
</ObjectDataProvider>
</ToolBarTray.Resources>

<ComboBox Name="colors" ItemsSource="{Binding Source={StaticResource colorPropertiesOdp}}" DisplayMemberPath="Name" SelectedValuePath="Name" MinWidth="100" ToolTip="Color" />

I am trying to make a selectionChanged event code that will change the text to the system colour selected by the user, if you need to see more code or need more info let me know. The comboBox is just being loaded with the name of the colour, so HOW do I use that name to get the actual color itself in the event code to set the text to the new colour?
Thanks, Beef

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T19:28:49+00:00Added an answer on May 24, 2026 at 7:28 pm

    Here is an example of binding (using the value of the combobox to fill a rectangle), and below is a an example of changing the color of the TextBlock that labels it (you would obviously update your selected text instead).

    Binding:

    <StackPanel Orientation="Horizontal"
                xmlns:sys="clr-namespace:System;assembly=mscorlib">
        <StackPanel.Resources>
            <ObjectDataProvider MethodName="GetType" 
                                ObjectType="{x:Type sys:Type}" 
                                x:Key="colorsTypeOdp">
                <ObjectDataProvider.MethodParameters>
                    <sys:String>System.Windows.Media.Colors, PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</sys:String>
                </ObjectDataProvider.MethodParameters>
            </ObjectDataProvider>
            <ObjectDataProvider ObjectInstance="{StaticResource colorsTypeOdp}"
                                MethodName="GetProperties" 
                                x:Key="colorPropertiesOdp" /> 
        </StackPanel.Resources>
        <!--  SelectedValuePath="Name" -->
        <ComboBox Name="colors" 
                  ItemsSource="{Binding Source={StaticResource colorPropertiesOdp}}" 
                  DisplayMemberPath="Name" 
                  SelectedValuePath="Name"
                  MinWidth="100" 
                  ToolTip="Color" />
        <Rectangle Width="100"
                   Height="50"
                   Stroke="White"
                   StrokeThickness="2">
            <Rectangle.Fill>
                <SolidColorBrush Color="{Binding ElementName=colors, Path=SelectedValue}" />
            </Rectangle.Fill>
        </Rectangle>
        <TextBlock x:Name="txtColor" 
                   Foreground="White"
                   Text="{Binding ElementName=colors, Path=SelectedValue}" />
    </StackPanel>
    

    Event:

        colors.SelectionChanged += (s, e) => 
        {
            BrushConverter converter = new BrushConverter();
            txtColor.Foreground = converter.ConvertFromString(colors.SelectedValue.ToString()) as SolidColorBrush;
        };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use SendMessage to Notepad, so that I can insert written text
I'm making a windows application where user selects a type from combo box. Based
I've been looking for an IDE or Text Editor that can save snapshots of
i am making an email application,where user can set his time to send email?
I am in the process of making a website that involves a shopping cart.
I'm in the process of making some changes to my site, and I'm running
I'm making an AJAX call to retrieve some plain text: $.ajax({ url: programData.txt, type:
When making a simple WYSIWYG editor with JavaScript for a textarea I can check
I'm making an application that will monitor the state of another process and restart
I am making a Java program and want to open a text(notepad) file ,that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.