Click here to Skip to main content
15,888,816 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: BusyIndicator with uncommited new row in Datagrid throws exception Pin
Mycroft Holmes16-Apr-12 3:20
professionalMycroft Holmes16-Apr-12 3:20 
QuestionHow to overwrite current styles at runtime Pin
Errorrist14-Apr-12 2:44
Errorrist14-Apr-12 2:44 
QuestionLoading image to Stackpanel Pin
pix_programmer13-Apr-12 20:26
pix_programmer13-Apr-12 20:26 
AnswerRe: Loading image to Stackpanel Pin
Abhinav S13-Apr-12 20:48
Abhinav S13-Apr-12 20:48 
GeneralRe: Loading image to Stackpanel Pin
pix_programmer13-Apr-12 21:15
pix_programmer13-Apr-12 21:15 
AnswerRe: Loading image to Stackpanel Pin
Abhinav S14-Apr-12 4:53
Abhinav S14-Apr-12 4:53 
QuestionTabbed page navigation with separated navigation buttons Pin
Antonino Porcino13-Apr-12 8:52
Antonino Porcino13-Apr-12 8:52 
QuestionSet size for all "Window" in project at runtime Pin
Errorrist13-Apr-12 1:37
Errorrist13-Apr-12 1:37 
Im using styles for my WPF Windows. Is there an easy way that I can change values at runtime, so that all Elements which have this stlye will change there value?
Like in CSS ( Cascading Style Sheets )

At the moment I have to go to every Window and programm it like that:

in my XAML-Code I have buttons like this:

HTML
<Button Name"Button2" Style="{StaticResource myFunctionButtonStyle}" ...>



Allthough my button has a Style, I have to change the FontSize at runtime for evey Button in every Window like this:

C#
private void SetFontSize(int i)
        {
            Button2.FontSize = i;
            Button3.FontSize = i;
            Button4.FontSize = i;
        }


But this way is very redundant code. I have to this this for every Window and every Button!

But I cannot change the current style. I tryed something like this for my Window-Size:

C#
((Style)Resources["MainWindow"]).Setters.Add(new Setter { Property = Window.WidthProperty, Value = (double)1024 });  


But it doesn work because I cannot change the current style at runtime. It is just not allowed
AnswerRe: Set size for all "Window" in project at runtime Pin
Wes Aday13-Apr-12 3:22
professionalWes Aday13-Apr-12 3:22 
AnswerRe: Set size for all "Window" in project at runtime Pin
Wayne Gaylard13-Apr-12 3:25
professionalWayne Gaylard13-Apr-12 3:25 
AnswerRe: Set size for all "Window" in project at runtime Pin
Errorrist13-Apr-12 8:35
Errorrist13-Apr-12 8:35 
Questioninsert data from excel file into datagrid Pin
MemberDotNetting12-Apr-12 23:23
MemberDotNetting12-Apr-12 23:23 
QuestionRe: insert data from excel file into datagrid Pin
Richard MacCutchan13-Apr-12 0:18
mveRichard MacCutchan13-Apr-12 0:18 
AnswerRe: insert data from excel file into datagrid Pin
MemberDotNetting13-Apr-12 1:45
MemberDotNetting13-Apr-12 1:45 
GeneralRe: insert data from excel file into datagrid Pin
Richard MacCutchan13-Apr-12 2:52
mveRichard MacCutchan13-Apr-12 2:52 
GeneralRe: insert data from excel file into datagrid Pin
MemberDotNetting13-Apr-12 4:28
MemberDotNetting13-Apr-12 4:28 
AnswerRe: insert data from excel file into datagrid Pin
Bernhard Hiller13-Apr-12 0:31
Bernhard Hiller13-Apr-12 0:31 
GeneralRe: insert data from excel file into datagrid Pin
MemberDotNetting13-Apr-12 1:45
MemberDotNetting13-Apr-12 1:45 
Questiondatagrid collection Pin
michaelgr111-Apr-12 8:53
michaelgr111-Apr-12 8:53 
QuestionBinding TextBox to DataGrid - WPF C# Pin
Sutton Mehaffey11-Apr-12 7:04
Sutton Mehaffey11-Apr-12 7:04 
QuestionTimer Pin
pix_programmer10-Apr-12 6:40
pix_programmer10-Apr-12 6:40 
AnswerRe: Timer Pin
Mycroft Holmes10-Apr-12 13:07
professionalMycroft Holmes10-Apr-12 13:07 
GeneralRe: Timer Pin
Pete O'Hanlon10-Apr-12 20:27
mvePete O'Hanlon10-Apr-12 20:27 
GeneralRe: Timer Pin
Mycroft Holmes10-Apr-12 20:48
professionalMycroft Holmes10-Apr-12 20:48 
AnswerRe: Timer Pin
Andy41111-Apr-12 2:37
Andy41111-Apr-12 2:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.