Question Vertical news scroller with databound hyperlinks

rubensoda

New member
Joined
Nov 18, 2010
Messages
1
Programming Experience
1-3
Hallo from Italy

Sorry for my english. Hope you understand..
I'm inexpert in WPF-XBAP (vs2010 nf4.0). I would like to create a vertical news ticker by following spec :

- News should come from db table (my db is postgresql)
- Scrolling news will be shown as hyperlink
- Every news clicked will open a window where the new's text will be showed entirely
- Manage mouse_enter and mouse_leave events in order to pause, resume the scrolling animation when mouse pointer is
entering/ leaving the news area

I started from this code found in the web :

XAML:

<Page x:Class="IndexContentPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" designHeight="700" designWidth="1000"
Title="ContentPage1" Background="PaleGoldenrod" ShowsNavigationUI="False">
<Grid>

<Canvas Height="165" Background="Transparent" x:Name="ClipCanvas" Width="240">
<Canvas.Clip>
<RectangleGeometry Rect="0,0,240,165"></RectangleGeometry>
</Canvas.Clip>

<Canvas Height="165" Background="Transparent" x:Name="Marquee" Width="240"
Canvas.Top="165" RenderTransformOrigin="0.5,0.5">
<Canvas.Triggers>
<EventTrigger RoutedEvent="Canvas.Loaded">
<BeginStoryboard>
<Storyboard x:Name="marqueestory">
<DoubleAnimation RepeatBehavior="Forever"
BeginTime="0:00:2"
Storyboard.TargetName="Marquee"
Storyboard.TargetProperty="(Canvas.Top)"
To="-165"
Duration="0:0:10"></DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Canvas.Triggers>
<StackPanel>
<TextBlock>
<Hyperlink NavigateUri="http://www.yahoo.com" TargetName="_blank" >
<TextBlock Text="yahoo news" FontSize="11" Foreground="DarkGray" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" />
</Hyperlink>
</TextBlock>
<TextBlock>
<Hyperlink NavigateUri="http://www.google.com" TargetName="_blank" >
<TextBlock Text="google site" FontSize="11" Foreground="DarkGray" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" />
</Hyperlink>
</TextBlock>
<TextBlock>
<Hyperlink NavigateUri="http://www.postgresql.org" TargetName="_blank" >
<TextBlock Text="postgresql database" FontSize="11" Foreground="DarkGray" TextWrapping="NoWrap" TextTrimming="CharacterEllipsis" />
</Hyperlink>
</TextBlock>
</StackPanel>
</Canvas>
</Canvas>
<Button Content="Button" Click="pausing_event" Height="23" HorizontalAlignment="Left" Margin="145,155,0,0" Name="Button1" VerticalAlignment="Top" Width="75" />
</Grid>
</Page>

VB:

Class IndexContentPage
Public Sub New()
InitializeComponent()
AddHandler Marquee.MouseLeave, New MouseEventHandler(AddressOf Marquee_MouseLeave)
AddHandler Marquee.MouseEnter, New MouseEventHandler(AddressOf Marquee_MouseEnter)
End Sub
Private Sub Marquee_MouseLeave(ByVal sender As Object, ByVal e As MouseEventArgs)
Me.marqueestory.Resume()
End Sub
Private Sub Marquee_MouseEnter(ByVal sender As Object, ByVal e As MouseEventArgs)
Me.marqueestory.Pause()
End Sub
End Class

I'm in trouble with :
- obtain the pause of the scrolling animation
- implementing data binding of the news (from db table toward textblock) and show them as hyperlink


Anybody may help me please ?

Thanx in advance
 
Back
Top