locked
hyperlinkButton in listview

    Question

  • Dear team,

                    i am trying to bind values in Listview with hyperlink button. but i am not able to bind the value to hyperlinkbutton. 

    <ListView VerticalAlignment="Center" HorizontalAlignment="Center" x:Name="EmployeeRecord" ItemsSource="{Binding}">
                    <ListView.ItemTemplate>
                        <DataTemplate>
                         
                                <StackPanel Orientation="Horizontal">
                                <HyperlinkButton Content="{Binding Path= Slno}" Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Left" Width="50" FontWeight="Bold" Click="hyperlinkbuttonClick" />
                                 <TextBlock Text="{Binding Path=Topic}" Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Left" Width="200" FontWeight="Bold"/>
                                <TextBlock Text="{Binding Path=Answer}" Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" Width="150" FontWeight="Bold"/>
                                <TextBlock Text="{Binding Path=SelectedAnswer}" Style="{StaticResource BasicTextStyle}" HorizontalAlignment="Center" Width="150" FontWeight="Bold"/>
                                
                            </StackPanel>
                       
                        </DataTemplate>
                    </ListView.ItemTemplate>
                </ListView>
     Error at 

    kindly help

    Wednesday, November 05, 2014 5:58 PM

Answers

  • Thanks rob,

           i have changed the click event to listview to solve this issue.


    • Edited by mann madhan1 Saturday, November 08, 2014 6:53 AM
    • Proposed as answer by Magnus (MM8)MVP Saturday, November 08, 2014 10:43 AM
    • Marked as answer by mann madhan1 Thursday, November 13, 2014 1:35 PM
    Saturday, November 08, 2014 6:53 AM

All replies

  • It would help if you would post the error (not just a stacktrace of the default exception handler) and what the data object your ListView items are bound to is.

    Your HyperlinkButton binding works well for me when Slno is a string.

    --Rob

    Wednesday, November 05, 2014 11:17 PM
    Owner
  • Dear Rob,

               this the following error i am getting. even though i used string object

    sorry now only i  figured  it out the error point . it is  in app.xaml (contosocookbook sample code)

     protected override async void OnLaunched(LaunchActivatedEventArgs args)
            {
    .
    .
    .
    .
    .
    
     Window.Current.Activate();  // in this place only 
            }

    if i am using the Textblock instead of hyperlinkbutton i did not get any error message.

    kindly help


    Thursday, November 06, 2014 4:03 AM
  • That's not the error. That's just a rethrow. You need to look at the actual Exception object.

    What is the data object that you are binding to? In particular, what does the Slno property return?

    I confirmed that your HyperlinkButton binding works correctly for me when bound to an object where Slno returns a string.

    Can you share a minimal repro sample that demonstrates the problem?

    Thursday, November 06, 2014 6:30 PM
    Owner
  • Thanks rob,

           i have changed the click event to listview to solve this issue.


    • Edited by mann madhan1 Saturday, November 08, 2014 6:53 AM
    • Proposed as answer by Magnus (MM8)MVP Saturday, November 08, 2014 10:43 AM
    • Marked as answer by mann madhan1 Thursday, November 13, 2014 1:35 PM
    Saturday, November 08, 2014 6:53 AM