IntroductionWPF seems to be hot topic in windows developer community these days , so i wanted to explore and learn it by by writing some application and it appeared like TileGame (See Fig.1) which I used to play as a child seemed perfect fit for this and becuase software provides much more flexibility than plastic case, we can make playing this game a much better experience and thought following requirements would help in it.
<Rectangle x:Name="buttonHoverButton" Opacity="0" RadiusX="5" RadiusY="5"> <Rectangle.Fill> <RadialGradientBrush> <GradientStop Color="White" Offset="1"/> <GradientStop Color="Indigo" Offset="0.9"/> <GradientStop Color="Blue" Offset="0.8"/> <GradientStop Color="LawnGreen" Offset="0.7"/> <GradientStop Color="Yellow" Offset="0.6"/> <GradientStop Color="Orange" Offset="0.5"/> <GradientStop Color="Violet" Offset="0.4"/> <GradientStop Color="Transparent" Offset="0"/> </RadialGradientBrush> </Rectangle.Fill> These are not exactly rainbow colors, but are almost similar exculding red but not in order, but looked enough, that last brush "<GradientStop Color="Transparent" Offset="0"/>" is necessary so that content shows up.Now that we have look for button ready, we need to associate this with "MouseEnter" event and for this we need to use triggers provided by control template. we will do it in following way <ControlTemplate.Triggers> <EventTrigger RoutedEvent="Button.MouseEnter"> <EventTrigger.Actions> <BeginStoryboard> <Storyboard> <DoubleAnimation Storyboard.TargetName="buttonHoverButton" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.25" /> </Storyboard> </BeginStoryboard> </EventTrigger.Actions> </EventTrigger>
checkforwinner() has necessary code.Undo and Replay
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: