Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
AnswerRe: Store persistent data Pin
Abhinav S7-Oct-16 20:23
Abhinav S7-Oct-16 20:23 
GeneralRe: Store persistent data Pin
sunsher9-Oct-16 16:26
sunsher9-Oct-16 16:26 
GeneralRe: Store persistent data Pin
Mycroft Holmes9-Oct-16 17:24
professionalMycroft Holmes9-Oct-16 17:24 
GeneralRe: Store persistent data Pin
sunsher10-Oct-16 0:16
sunsher10-Oct-16 0:16 
GeneralRe: Store persistent data Pin
Mycroft Holmes10-Oct-16 12:37
professionalMycroft Holmes10-Oct-16 12:37 
QuestionExecuting PS1 file to perform a task in Exchange Pin
choppol6-Oct-16 12:29
choppol6-Oct-16 12:29 
AnswerRe: Executing PS1 file to perform a task in Exchange Pin
Eddy Vluggen7-Oct-16 11:51
professionalEddy Vluggen7-Oct-16 11:51 
QuestionCan someone explain this WPF oddity? Pin
Foothill6-Oct-16 9:47
professionalFoothill6-Oct-16 9:47 
To set things up, what I was trying to do was make a TextBox flash when a user misses a required input. I got it to work but I don't understand the error I was getting at first.

Code that had an exception:
C#
private void FlashRequiredTextBox(TextBox target)
{
 ColorAnimation flash = new ColorAnimation(Colors.White, Colors.Red, new Duration(TimeSpan.FromMilliseconds(75D))) { AutoReverse = true, RepeatBehavior = new RepeatBehavior(5D) };
 target.Background.BeginAnimation(SolidColorBrush.ColorProperty, flash);
}

The exception that was thrown:
Cannot animate the 'Color' property on 'System.Windows.Media.SolidColorBrush' because the object is sealed or frozen.

I understand why the exception is thrown but what I don't get is why this code fixes it.
C#
private void FlashRequiredTextBox(TextBox target)
{
 ColorAnimation flash = new ColorAnimation(Colors.White, Colors.Red, new Duration(TimeSpan.FromMilliseconds(75D))) { AutoReverse = true, RepeatBehavior = new RepeatBehavior(5D) };
 target.Background = new SolidColorBrush(Colors.White); // set the backbround and voila, no error???
 target.Background.BeginAnimation(SolidColorBrush.ColorProperty, flash);
}

Can somebody with a better understanding of WPF control rendering explain this?
if (Object.DividedByZero == true) { Universe.Implode(); }
Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016

AnswerRe: Can someone explain this WPF oddity? PinPopular
Richard Deeming6-Oct-16 11:44
mveRichard Deeming6-Oct-16 11:44 
GeneralRe: Can someone explain this WPF oddity? Pin
Mycroft Holmes6-Oct-16 12:41
professionalMycroft Holmes6-Oct-16 12:41 
GeneralRe: Can someone explain this WPF oddity? Pin
Foothill7-Oct-16 3:15
professionalFoothill7-Oct-16 3:15 
QuestionEventRecord's FormatDescription() is super slow Pin
_PitrakSarkar_4-Oct-16 20:05
_PitrakSarkar_4-Oct-16 20:05 
AnswerRe: EventRecord's FormatDescription() is super slow Pin
Pete O'Hanlon4-Oct-16 23:29
mvePete O'Hanlon4-Oct-16 23:29 
GeneralRe: EventRecord's FormatDescription() is super slow Pin
_PitrakSarkar_5-Oct-16 0:07
_PitrakSarkar_5-Oct-16 0:07 
GeneralRe: EventRecord's FormatDescription() is super slow Pin
Lucas Alvarez Lacasa21-Nov-18 8:10
Lucas Alvarez Lacasa21-Nov-18 8:10 
QuestionC# to C++ SEND AND RECIEVED Pin
Jarlo Belledo4-Oct-16 2:14
Jarlo Belledo4-Oct-16 2:14 
AnswerRe: C# to C++ SEND AND RECIEVED Pin
OriginalGriff4-Oct-16 2:28
mveOriginalGriff4-Oct-16 2:28 
AnswerRe: C# to C++ SEND AND RECIEVED Pin
NotPolitcallyCorrect4-Oct-16 2:45
NotPolitcallyCorrect4-Oct-16 2:45 
AnswerRe: C# to C++ SEND AND RECIEVED Pin
Eddy Vluggen4-Oct-16 3:01
professionalEddy Vluggen4-Oct-16 3:01 
AnswerRe: C# to C++ SEND AND RECIEVED Pin
Pete O'Hanlon4-Oct-16 3:04
mvePete O'Hanlon4-Oct-16 3:04 
GeneralRe: C# to C++ SEND AND RECIEVED PinPopular
Mycroft Holmes4-Oct-16 12:50
professionalMycroft Holmes4-Oct-16 12:50 
QuestionRunning Powershell scripts in C# fails/no effect Pin
me@dagsunde.com3-Oct-16 22:35
professionalme@dagsunde.com3-Oct-16 22:35 
AnswerRe: Running Powershell scripts in C# fails/no effect Pin
Pete O'Hanlon3-Oct-16 23:44
mvePete O'Hanlon3-Oct-16 23:44 
GeneralRe: Running Powershell scripts in C# fails/no effect Pin
me@dagsunde.com4-Oct-16 0:20
professionalme@dagsunde.com4-Oct-16 0:20 
GeneralRe: Running Powershell scripts in C# fails/no effect Pin
me@dagsunde.com3-Oct-16 23:52
professionalme@dagsunde.com3-Oct-16 23:52 

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.