<ListView Name="listUsers"
SelectionMode="Single" Height="200"
SelectionChanged="listUsers_SelectionChanged">
<ListView.View>
<GridView AllowsColumnReorder="true"
x:Name="grdCustomer">
<GridViewColumn Header="User Id"
>
<GridViewColumn.CellTemplate>
<DataTemplate>
<Button Name="btnUserId"
Cursor="Hand" Tag="{Binding Path=UserId }" Click="btnUserId_Click"
Content="{Binding Path=UserId }" Style="{StaticResource LinkButton}">Button>
DataTemplate>
GridViewColumn.CellTemplate>
GridViewColumn>
<GridViewColumn Header="Mobile" >
<GridViewColumn.CellTemplate>
<DataTemplate>
<Label Foreground="DarkBlue"
Name="lblMobile" HorizontalAlignment="Center">
<Label.Content>
<Binding Path="Mobile"/>
Label.Content>
Label>
DataTemplate>
GridViewColumn.CellTemplate>
GridViewColumn>
GridView>
ListView.View>
ListView>


Santhosh Kumar JayaramanRank #563 · 4.3K reputationPosted Feb 5, 2013, 3:17 AM EST
Your button will look like
<Button Name="btnUserId" Cursor="Hand" Tag="{Binding Path=UserId }" Click="btnUserId_Click" Content="{Binding Path=UserId }" Style="{StaticResource LinkButton}" CommandParameter="{Binding Path=Mobile} >Button>
and in the button click event
private void Button_Click(object sender, RoutedEventArgs e)
{
object Mobile = ((Button)sender).CommandParameter;
}
Mahesh AlleRank #521 · 4.7K reputationPosted Feb 5, 2013, 8:17 PM EST
With you answer, I am finding the required value. But how to find the "lblMobile" control from my code behind like findcontrol in asp.net.
Please help me.
Thank you for you answer.