Click here to Skip to main content
15,891,431 members
Home / Discussions / WPF
   

WPF

 
RantMVVM makes no sense for Silverlight Pin
User 467791610-May-10 9:29
User 467791610-May-10 9:29 
GeneralRe: MVVM makes no sense for Silverlight Pin
Abhinav S10-May-10 10:03
Abhinav S10-May-10 10:03 
QuestionQuestion and thoughts about dragging objects Pin
_Zorro_10-May-10 0:20
professional_Zorro_10-May-10 0:20 
AnswerRe: Question and thoughts about dragging objects Pin
Pete O'Hanlon10-May-10 0:38
mvePete O'Hanlon10-May-10 0:38 
GeneralRe: Question and thoughts about dragging objects Pin
_Zorro_10-May-10 2:12
professional_Zorro_10-May-10 2:12 
AnswerRe: Question and thoughts about dragging objects Pin
Abhinav S10-May-10 0:40
Abhinav S10-May-10 0:40 
GeneralRe: Question and thoughts about dragging objects Pin
_Zorro_10-May-10 2:15
professional_Zorro_10-May-10 2:15 
QuestionWPF Styles and Animations Pin
DTh19789-May-10 21:28
DTh19789-May-10 21:28 
Hello

I have a question and was hoping that someone could help me. I am not too sure how to approach it.

Basically all i want to do is to change the colour of an object based on a bound value. Not only do i want the colour to change based on a bound value but for certain values i want the colour to flash also.

I have a class that I have developed that inherits framework element, i then override the onrender method to draw my object. For example a rectangle. I have a dependency property called Status of type brush which is bound using a converter. This works great for changing the colour when the bound value changes but i cannot flash the colour using this method.

I am now looking at styles and animiations to do this. but i am running into the problem of once the first animation has begun i cannot then run another animation if i am using FillBehavior="HoldEnd".

Example


<DataTrigger Value = "30" >

                    <DataTrigger.Binding>
                        <Binding RelativeSource ="{RelativeSource Self}" Path = "Width"/>
                    </DataTrigger.Binding>

                    <DataTrigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard >
                                <ColorAnimation Storyboard.TargetProperty="(Fill).(SolidColorBrush.Color)" To=" Pink" RepeatBehavior= "Forever" Duration="0:0:0.2" AutoReverse="True" ></ColorAnimation>
                            </Storyboard>
                        </BeginStoryboard>
                    </DataTrigger.EnterActions>

                </DataTrigger>


                <DataTrigger Value = "40" >

                    <DataTrigger.Binding>
                        <Binding RelativeSource ="{RelativeSource Self}" Path = "Width"/>
                    </DataTrigger.Binding>

                    <DataTrigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard >
                                <ColorAnimation Storyboard.TargetProperty="(Fill).(SolidColorBrush.Color)" To="Yellow" FillBehavior="HoldEnd" ></ColorAnimation>
                            </Storyboard>
                        </BeginStoryboard>
                    </DataTrigger.EnterActions>

                </DataTrigger>


---




If i run the above code once my value reaches 40 and the animation begins to change the color to Yellow. I cannot then get the animation for value 30 to work.

What i want is to change the color of my object using animations. if the bound value is for example 30 i want the color to be pink, then if the value changes to 40 i then want the color to change to yellow. I understand what the fillbehaviour does but i do not want the animation to stop until the bound value has changed.



Any ideas.



Thanks
QuestionSilverlight Date Validation Question... Pin
datahead9-May-10 10:24
datahead9-May-10 10:24 
AnswerRe: Silverlight Date Validation Question... Pin
Abhinav S9-May-10 19:25
Abhinav S9-May-10 19:25 
QuestionWPF ListView scrollable height Pin
astibich27-May-10 11:28
astibich27-May-10 11:28 
AnswerRe: WPF ListView scrollable height Pin
Leung Yat Chun8-May-10 23:13
Leung Yat Chun8-May-10 23:13 
QuestionExpression Web....Not sure if this is the right place to post. Pin
programmervb.netc++6-May-10 21:24
programmervb.netc++6-May-10 21:24 
AnswerRe: Expression Web....Not sure if this is the right place to post. Pin
#realJSOP9-May-10 1:19
mve#realJSOP9-May-10 1:19 
AnswerRe: Expression Web....Not sure if this is the right place to post. Pin
#realJSOP12-May-10 2:09
mve#realJSOP12-May-10 2:09 
QuestionPass params to web service [SOLVED (but it ain't pretty)] Pin
#realJSOP6-May-10 9:16
mve#realJSOP6-May-10 9:16 
AnswerRe: Pass params to web service Pin
Not Active6-May-10 9:44
mentorNot Active6-May-10 9:44 
GeneralRe: Pass params to web service Pin
#realJSOP6-May-10 10:54
mve#realJSOP6-May-10 10:54 
GeneralRe: Pass params to web service Pin
#realJSOP7-May-10 5:33
mve#realJSOP7-May-10 5:33 
GeneralRe: Pass params to web service Pin
Not Active7-May-10 7:01
mentorNot Active7-May-10 7:01 
AnswerRe: Pass params to web service Pin
Abhinav S7-May-10 0:23
Abhinav S7-May-10 0:23 
GeneralRe: Pass params to web service Pin
#realJSOP7-May-10 1:52
mve#realJSOP7-May-10 1:52 
GeneralRe: Pass params to web service Pin
#realJSOP7-May-10 5:33
mve#realJSOP7-May-10 5:33 
GeneralRe: Pass params to web service Pin
Abhinav S7-May-10 6:32
Abhinav S7-May-10 6:32 
QuestionWPF UserControl design question Pin
Alex Barry6-May-10 5:38
Alex Barry6-May-10 5:38 

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.