?
Solved

WPF TreeView Item Hyperlink- How to create a TreeViewITem that is a hyperlink?

Posted on 2010-11-10
5
Medium Priority
?
1,545 Views
Last Modified: 2013-11-12
I have a treeview like this

Fruit
 --   Apples
      ---  Mac
      --    Jon
--   Oranges


On the Apple Node and Orange node I want to make a hyperlink that can be clicked on and navigated to a url... thanks
0
Comment
Question by:JElster
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 4

Expert Comment

by:grishav
ID: 34109327
You can manage this with HtmlTextBlock (as I sent you yesterday - http://www.codeproject.com/KB/WPF/htmltextblock.aspx).

But probably much simpler idea is to "fake" the hyperlink:
just make a button with usual TextBlock inside (underline the text to make it similar to standard hyperlink) and add a click handler which will open some Frame. THen you can use Navigate method of Frame class to go to the url you need.
Good luck
0
 
LVL 1

Author Comment

by:JElster
ID: 34111153
Hi..
I need to create the hyperlink in code.. how can I do that?
thx
0
 
LVL 4

Expert Comment

by:grishav
ID: 34111219
0
 
LVL 1

Author Comment

by:JElster
ID: 34111298
How do i programmatically create

 <Grid>

        <TextBlock>Outside area of frame</TextBlock>

        <Frame Name="FrameWithinGrid" >

        </Frame>

        <Button Height="23" Margin="114,12,25,0"

                Name="button1" VerticalAlignment="Top" Click="button1_Click">Navigate to C# Corner

        </Button>

    </Grid>

0
 
LVL 4

Accepted Solution

by:
grishav earned 800 total points
ID: 34111347
Something like :

Grid g = new Grid();
g.Children.Add(new TextBlock("Outside area of frame"));
Frame fr = new Frame();
g.Children.Add(fr);
Button b = new Button();
g.Children.Add(b);
b.Height = 23;
b.Margin = new Margin(114,12,25,0);
b.Click += MyFunc  etc.

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question