Click here to Skip to main content
15,899,026 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Call Web Service From Silverlight Application Pin
Pete O'Hanlon12-Jul-12 23:07
mvePete O'Hanlon12-Jul-12 23:07 
GeneralRe: Call Web Service From Silverlight Application Pin
youness13-Jul-12 5:23
youness13-Jul-12 5:23 
GeneralRe: Call Web Service From Silverlight Application PinPopular
Pete O'Hanlon15-Jul-12 11:13
mvePete O'Hanlon15-Jul-12 11:13 
GeneralRe: Call Web Service From Silverlight Application Pin
Mycroft Holmes16-Jul-12 0:34
professionalMycroft Holmes16-Jul-12 0:34 
GeneralRe: Call Web Service From Silverlight Application Pin
Pete O'Hanlon16-Jul-12 1:15
mvePete O'Hanlon16-Jul-12 1:15 
AnswerRe: Call Web Service From Silverlight Application Pin
Anumeha Shukla15-Jul-12 23:36
Anumeha Shukla15-Jul-12 23:36 
AnswerRe: Call Web Service From Silverlight Application Pin
vinodkrebc17-Jul-12 19:46
vinodkrebc17-Jul-12 19:46 
QuestionWPF Hyperlink In Treeview Problem Pin
Kevin Marois12-Jul-12 10:26
professionalKevin Marois12-Jul-12 10:26 
I'v been struggling with this all morning. Cold use some help...

I have created a HierarchicalDataTemplate used in a treeview. I have a class that overrides the basic treeview, called TreeViewEx, that I got from someone here at CP. (Can't remember who - sorry).

At any rate, here's the template:

<HierarchicalDataTemplate DataType="{x:Type models:TreeItemModel}"
                        ItemsSource="{Binding Path=Children}">
    <StackPanel Orientation="Horizontal"
            Margin="2">

        <TextBlock Margin="0,0,5,0">
            <Hyperlink NavigateUri="{Binding Caption}"
                        Foreground="#0C2DAA"
                        Style="{StaticResource linkStyle}"
                        Command="{Binding Path=DataContext.SelectedLinkCommand,
                                RelativeSource={RelativeSource FindAncestor, 
                                AncestorType={ x:Type views:MainWindowView}}}">

                <InlineUIContainer>
                    <TextBlock Text="{Binding Caption}" />
                </InlineUIContainer>

            </Hyperlink>

        </TextBlock>

    </StackPanel>

</HierarchicalDataTemplate>


and here's the treeview usage:

<controls:TreeViewEx ItemsSource="{Binding TreeItems}"/>


and finally the code behind:

private TreeItemModel _SelectedTreeLink;
public TreeItemModel SelectedTreeLink
{
    get { return _SelectedTreeLink; }
    set
    {
        if (_SelectedTreeLink != value)
        {
            _SelectedTreeLink = value;
            RaisePropertyChanged("SelectedTreeLink");
        }
    }
}

private ICommand _SelectedLinkCommand;
public ICommand SelectedLinkCommand
{
    get
    {
        if (_SelectedLinkCommand == null)
            _SelectedLinkCommand = new RelayCommand(SelectedLinkExecuted, SelectedLinkCanExecute);

        return _SelectedLinkCommand;
    }
}

private bool SelectedLinkCanExecute()
{
    return true;
}
private void SelectedLinkExecuted()
{
    var item = SelectedTreeLink;
}


The tree loads with data fine, and they tree nodes are hyperlinks. The command works. However, when I break in the SelectedLinkExecuted method, SelectedTreeLink = null.

How can I get a reference to the data model behind the link?

Thanks
If it's not broken, fix it until it is

AnswerRe: WPF Hyperlink In Treeview Problem Pin
Ian Shlasko12-Jul-12 10:55
Ian Shlasko12-Jul-12 10:55 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
Kevin Marois12-Jul-12 11:10
professionalKevin Marois12-Jul-12 11:10 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
Ian Shlasko12-Jul-12 11:22
Ian Shlasko12-Jul-12 11:22 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
SledgeHammer0112-Jul-12 11:23
SledgeHammer0112-Jul-12 11:23 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
Kevin Marois12-Jul-12 11:34
professionalKevin Marois12-Jul-12 11:34 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
SledgeHammer0112-Jul-12 12:13
SledgeHammer0112-Jul-12 12:13 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
Kevin Marois12-Jul-12 12:23
professionalKevin Marois12-Jul-12 12:23 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
SledgeHammer0112-Jul-12 12:54
SledgeHammer0112-Jul-12 12:54 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
SledgeHammer0112-Jul-12 12:58
SledgeHammer0112-Jul-12 12:58 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
Kevin Marois12-Jul-12 13:17
professionalKevin Marois12-Jul-12 13:17 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
Kevin Marois13-Jul-12 8:48
professionalKevin Marois13-Jul-12 8:48 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
SledgeHammer0113-Jul-12 9:08
SledgeHammer0113-Jul-12 9:08 
GeneralRe: WPF Hyperlink In Treeview Problem Pin
Kevin Marois13-Jul-12 9:33
professionalKevin Marois13-Jul-12 9:33 
QuestionSilverlight Application vs Silverlight Business Application Pin
Kevin Marois12-Jul-12 6:14
professionalKevin Marois12-Jul-12 6:14 
AnswerRe: Silverlight Application vs Silverlight Business Application Pin
RobCroll12-Jul-12 13:08
RobCroll12-Jul-12 13:08 
GeneralRe: Silverlight Application vs Silverlight Business Application Pin
Kevin Marois12-Jul-12 13:18
professionalKevin Marois12-Jul-12 13:18 
QuestionWPF Charting Grouped Column Chart Pin
jonathan1512-Jul-12 3:29
jonathan1512-Jul-12 3:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.