Solved

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

Posted on 2010-11-10
5
1,514 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
  • 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 200 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
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…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now