How to change image at run-time corresponding time of day (24 hour format)?
-
Hello everyone I have two images, image1 represent lunch and image2 represents dinner. When I run my application the image1 is displayed on main window. How can I change image1 to image2 corresponding time of day (at run-time)? For instance: lets say from 12:00 to 17:00 I want my image1 to be displayed at main window, and from 17:00 to 23:00 I want to display image2 at main window. could someone please help me solve this problem, Hence: I'm new to WPF... thanks in advance kind regards lapeci
-
Hello everyone I have two images, image1 represent lunch and image2 represents dinner. When I run my application the image1 is displayed on main window. How can I change image1 to image2 corresponding time of day (at run-time)? For instance: lets say from 12:00 to 17:00 I want my image1 to be displayed at main window, and from 17:00 to 23:00 I want to display image2 at main window. could someone please help me solve this problem, Hence: I'm new to WPF... thanks in advance kind regards lapeci
Presumably you have a property representing the image to be displayed and bind your xaml to the property. You then need a timer in your code (code behind or ViewModel). In the timers tick event you check the datetime.now and change the image property to the image you want to display.
Never underestimate the power of human stupidity RAH
-
Presumably you have a property representing the image to be displayed and bind your xaml to the property. You then need a timer in your code (code behind or ViewModel). In the timers tick event you check the datetime.now and change the image property to the image you want to display.
Never underestimate the power of human stupidity RAH
-
Hello Mycroft Holmes Thanks for replying to my question... Is there any way you can help me with a sample code because I don't have a clue how to do it I'm very new to wpf... thanks in advance. kind regards lapeci
Sorry, I don't do code, you are going to have to work it out! If you get stuck with something then come back and we will help.
Never underestimate the power of human stupidity RAH