Forum > Coding >

AvalonEdit background color wont change

Unidentified

nobody do wut i do

Posts: 320

Threads: 9

Joined: Feb, 2021

Reputation: 2

Posted

hey its me again

 

so i been trying to give the avalon texteditor some background color using c#. 

problem is: background color wont change

 

function to add tab: 

        private TabItem AddTabItem()
        {
            int count = _tabItems.Count;

            // create new tab item
            TabItem tab = new TabItem();
            tab.Style = (Style)Resources["TabItemTemplate"];
            tab.Foreground = new SolidColorBrush(Colors.White);
            tab.Header = string.Format("Tab {0}", count);
            tab.Name = string.Format("tab{0}", count);
            tab.Content = new TextEditor { Background=new SolidColorBrush(Colors.Pink) };
            tab.HeaderTemplate = tabDynamic.FindResource("TabHeader") as DataTemplate;

            // add controls to tab item, this case I added just a textbox
            TextBox txt = new TextBox();
            txt.Name = "txt";

            tab.Content = txt;

            // insert tab item right before the last (+) tab item
            _tabItems.Insert(count - 1, tab);

            return tab;
        }

(yes this is pasted code)

result: https://unidentified.has-a-hot.mom/KOFnic

  • 0

Learning C++, C#, JavaScript Developer

I develop random stuff

Discord: Unidentified#1091

Explanation

Outflown

Posts: 714

Threads: 138

Joined: Nov, 2020

Reputation: 6

Replied

idk if avalon allows changed background colors

  • 0

I am a used-to-be programmer, now producer, rapper and artist

https://cdn.discordapp.com/attachments/593162491085979649/926285159047770152/visuals-000415636677-YGc9rS-t2480x520_1.jpg

Zera

Paul

vip

Posts: 1096

Threads: 28

Joined: Mar, 2020

Reputation: 41

Replied

@Explanation

 

yes it does????

  • 0

https://cdn.discordapp.com/attachments/995469995742068832/1073019970012848228/Untitled39_20220604185345.png

Unidentified

nobody do wut i do

Posts: 320

Threads: 9

Joined: Feb, 2021

Reputation: 2

Replied

@Explanation It does, i can change it in XAML but why not in C#?

  • 0

Learning C++, C#, JavaScript Developer

I develop random stuff

Discord: Unidentified#1091

Explanation

Outflown

Posts: 714

Threads: 138

Joined: Nov, 2020

Reputation: 6

Replied

@Zera oh i didnt know

  • 0

I am a used-to-be programmer, now producer, rapper and artist

https://cdn.discordapp.com/attachments/593162491085979649/926285159047770152/visuals-000415636677-YGc9rS-t2480x520_1.jpg

Posts: 1165

Threads: 72

Joined: Oct, 2019

Reputation: 89

Replied

TextEditor Txt = new TextEditor();
Txt.Background = new SolidColorBrush(Color.FromRgb(255, 255, 255));
  • 0

Unidentified

nobody do wut i do

Posts: 320

Threads: 9

Joined: Feb, 2021

Reputation: 2

Replied

@ImmuneLion318 Works, thank you.

  • 0

Learning C++, C#, JavaScript Developer

I develop random stuff

Discord: Unidentified#1091

Posts: 1165

Threads: 72

Joined: Oct, 2019

Reputation: 89

Replied

@Unidentified No Problem

  • 0

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )