Hi all
I am using the thememanager as follow:
using Infragistics.Themes;using Infragistics.Windows.Ribbon;namespace SapQmWp{ /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : XamRibbonWindow { public MainWindow() { InitializeComponent(); ThemeManager.ApplicationTheme = new Office2013Theme(); } }}
My question is, how can I change Textbox Background color with style?
Thanks
Sorry it works.
Thanks so much.
First of all thanks so much for your response.
I want to set global wide font size and did as follow:
Style style = new Style(typeof(TextBox)) {BasedOn = (Style) FindResource(typeof(TextBox))};style.Setters.Add(new Setter(TextBox.FontSizeProperty, (double)26));Resources.Add(typeof(TextBox), style);
It does not work at all. Can you please help me.
Hi Jean-Pascal,
If you want to apply the style to not all TextBox but only a few of them you can add then explicitly the new style in the resources of the TextBoxes which you want to style or add the style directly in the parent FrameworkElement which contains them like this:
ThemeManager.ApplicationTheme = new Office2013Theme();
Style themeBasedStyle = (Style)FindResource(typeof(TextBox)); //Option 1 Style style = new Style(typeof(TextBox), themeBasedStyle); style.Setters.Add(new Setter(TextBox.BackgroundProperty, Brushes.BlanchedAlmond)); tb_Styled.Resources.Add(typeof(TextBox), style); //Option 2 Style style2 = new Style(typeof(TextBox), themeBasedStyle); style2.Setters.Add(new Setter(TextBox.BackgroundProperty, Brushes.Red)); sp_StyledViaStackPanel.Resources.Add(typeof(TextBox), style2);
I have also created a sample project which demonstrates both of these scenarios.
Please have a look at it and if you have any questions do not hesitate to ask.
Thanks,Teodor
Or can you please create an example project?
First of all thanks so much.
But how to apply several of Textboxs not to all Textboxs in the application?