Linkbutton in WPF
Posted by Viral Sarvaiya on May 13, 2011
hello,
Today i learn new thing from my current project,
i have to use the linkbutton in wpf, there are no control like linkbutton as like asp.net control in wpf
we can use the button and set style as like link button…
here is the xaml code for set button as a linkbutton.
<Button Margin="5" Content="Test" Cursor="Hand" Name="BtnTest" Click="BtnTest_Click"> <Button.Template> <ControlTemplate TargetType="Button"> <TextBlock TextDecorations="Underline"> <ContentPresenter /> </TextBlock> </ControlTemplate> </Button.Template> <Button.Style> <Style TargetType="Button"> <Setter Property="Foreground" Value="Blue" /> <Style.Triggers> <Trigger Property="IsMouseOver" Value="true"> <Setter Property="Foreground" Value="Red" /> </Trigger> </Style.Triggers> </Style> </Button.Style> </Button>
now u can see the button is look like a link button
Enjoy coding…
This entry was posted on May 13, 2011 at 4:38 PM and is filed under ASP.NET, .Net, WPF. Tagged: Linkbutton, Linkbutton in WPF, Windows Presentation Foundation, WPF. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.




tejas Bhalani said
Hi Viral
I want to use timer in Wpf Browser Application
I have one page that automatically refersh every 10 sec
it done in asp.net but how to do that in wpf applicatin
can you help me?
viralsarvaiya said
Hi Tejas,
Using System.Windows.Threading;
Use DispatcherTimer for that.
private DispatcherTimer timer1;
and in your page load event,
timer1 = new DispatcherTimer();
timer1.Interval = TimeSpan.FromSeconds(1);
timer1.Tick += timer1_Tick;
timer1.Start();
and in your timer_Tick event you can write your logic that you want to check.
private void timer1_Tick(object sender, EventArgs e)
{
//Your Logic
}