First I need a WPF Application. In Visual Studio, click on the 'File>New>Project...' menu an select 'WPF Application' and name it anything you like. Again, I like to rename the Window1 default to something more meaningful, in this case 'MainWindow'. So you'll have to right click on 'Window1.xaml' in Solution Explorer and rename the file to Mainwindow.xaml. Then you'll have to open 'App.xaml' and change the line 'StartupUri="window.xaml1"' to 'StartupUri="Mainwindow.xaml"'. The last thing to do is to fix the Window1.xaml.cs file. Simply open 'Window1.xaml.cs' and change all occurrences of 'Window1' to 'MainWindow'.
Here is the xaml code I wrote for Mainwindow.xaml:
<Window x:Class="WPFStoryBoard.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Main Window" Height="300" Width="300"> <FlowDocumentReader ViewingMode="Scroll" Name="_flowDoc"> <FlowDocumentReader.Triggers> <EventTrigger RoutedEvent="FlowDocumentReader.MouseEnter"> <BeginStoryboard> <Storyboard TargetProperty="Opacity"> <DoubleAnimation From="1" To="0" Duration="0:0:3"/> </Storyboard> </BeginStoryboard> </EventTrigger> <EventTrigger RoutedEvent="FlowDocumentReader.MouseLeave"> <BeginStoryboard> <Storyboard TargetProperty="Opacity"> <DoubleAnimation From="0" To="1" Duration="0:0:3"/> </Storyboard> </BeginStoryboard> </EventTrigger> </FlowDocumentReader.Triggers> <FlowDocument Foreground="Black"> <Paragraph TextAlignment="Left" FontSize="12pt"> When, in the course of human events, it becomes necessary for one people to dissolve the political bonds which have connected them with another, and to assume among the powers of the earth, the separate and equal station to which the laws of nature and of nature's God entitle them, a decent respect to the opinions of mankind requires that they should declare the causes which impel them to the separation. </Paragraph> <Paragraph TextAlignment="Left" FontSize="12pt"> We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable rights, that among these are life, liberty and the pursuit of happiness. That to secure these rights, governments are instituted among men, deriving their just powers from the consent of the governed. That whenever any form of government becomes destructive to these ends, it is the right of the people to alter or to abolish it, and to institute new government, laying its foundation on such principles and organizing its powers in such form, as to them shall seem most likely to effect their safety and happiness. Prudence, indeed, will dictate that governments long established should not be changed for light and transient causes; and accordingly all experience hath shown that mankind are more disposed to suffer, while evils are sufferable, than to right themselves by abolishing the forms to which they are accustomed. But when a long train of abuses and usurpations, pursuing invariably the same object evinces a design to reduce them under absolute despotism, it is their right, it is their duty, to throw off such government, and to provide new guards for their future security. --Such has been the patient sufferance of these colonies; and such is now the necessity which constrains them to alter their former systems of government. The history of the present King of Great Britain is a history of repeated injuries and usurpations, all having in direct object the establishment of an absolute tyranny over these states. To prove this, let facts be submitted to a candid world. </Paragraph> <Paragraph> He has refused his assent to laws, the most wholesome and necessary for the public good. </Paragraph> <Paragraph> He has forbidden his governors to pass laws of immediate and pressing importance, unless suspended in their operation till his assent should be obtained; and when so suspended, he has utterly neglected to attend to them. </Paragraph> <Paragraph> He has refused to pass other laws for the accommodation of large districts of people, unless those people would relinquish the right of representation in the legislature, a right inestimable to them and formidable to tyrants only. </Paragraph> <Paragraph> He has called together legislative bodies at places unusual, uncomfortable, and distant from the depository of their public records, for the sole purpose of fatiguing them into compliance with his measures. </Paragraph> <Paragraph> He has dissolved representative houses repeatedly, for opposing with manly firmness his invasions on the rights of the people. </Paragraph> <Paragraph> He has refused for a long time, after such dissolutions, to cause others to be elected; whereby the legislative powers, incapable of annihilation, have returned to the people at large for their exercise; the state remaining in the meantime exposed to all the dangers of invasion from without, and convulsions within. </Paragraph> <Paragraph> He has endeavored to prevent the population of these states; for that purpose obstructing the laws for naturalization of foreigners; refusing to pass others to encourage their migration hither, and raising the conditions of new appropriations of lands. </Paragraph> <Paragraph> He has obstructed the administration of justice, by refusing his assent to laws for establishing judiciary powers. </Paragraph> <Paragraph> He has made judges dependent on his will alone, for the tenure of their offices, and the amount and payment of their salaries. </Paragraph> <Paragraph> He has erected a multitude of new offices, and sent hither swarms of officers to harass our people, and eat out their substance. </Paragraph> <Paragraph> He has kept among us, in times of peace, standing armies without the consent of our legislature. </Paragraph> <Paragraph> He has affected to render the military independent of and superior to civil power. </Paragraph> <Paragraph> He has combined with others to subject us to a jurisdiction foreign to our constitution, and unacknowledged by our laws; giving his assent to their acts of pretended legislation: </Paragraph> <Paragraph> For quartering large bodies of armed troops among us: </Paragraph> <Paragraph> For protecting them, by mock trial, from punishment for any murders which they should commit on the inhabitants of these states: </Paragraph> <Paragraph> For cutting off our trade with all parts of the world: </Paragraph> <Paragraph> For imposing taxes on us without our consent: </Paragraph> <Paragraph> For depriving us in many cases, of the benefits of trial by jury: </Paragraph> <Paragraph> For transporting us beyond seas to be tried for pretended offenses: </Paragraph> </FlowDocument> </FlowDocumentReader> </Window>
That's it. I think the StoryBoard class in WPF is really cool!