Solved

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

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Method 'OpenReport' of the object Docmd failed 7 31
C#: need to import an entire CSV file 4 59
Input parameteres to DragOver 2 19
SSRS Deployment problem 5 65
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…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and 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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

860 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