Solved

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

Posted on 2010-11-10
5
1,508 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
Comment Utility
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
Comment Utility
Hi..
I need to create the hyperlink in code.. how can I do that?
thx
0
 
LVL 4

Expert Comment

by:grishav
Comment Utility
0
 
LVL 1

Author Comment

by:JElster
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

763 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

6 Experts available now in Live!

Get 1:1 Help Now