Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8788739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T22:12:40+00:00 2026-06-13T22:12:40+00:00

I have a ListView showing a list of Accounts using MVVM & a custom

  • 0

I have a ListView showing a list of Accounts using MVVM & a custom template and working fine
Now on clicking the Acct Name, we need to execute a custom action which requires the current Acct object

Is there a way to set the Label.Tag property to the Acct object ?

the xaml def is below
env is vs2010 .net 4.0 c#

<ListView Name="lv1" Grid.Column="1" Grid.Row="4"
    ItemsSource="{Binding AccountsList}"
    Background="Transparent" BorderThickness="0">
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <StackPanel Orientation="Horizontal">
                <Image Source="/asm1;component/Images/Icons/pdf1.png" Width="12" Height="12" />
                <Label Content="{Binding Name}" Margin="0,0,25,0" 
                    ContextMenu="{x:Null}" Name="lblacctItem" 
                    MouseDoubleClick="lbl_MouseDoubleClick" />
            </StackPanel>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
    <ListView.ItemsPanel>
        <ItemsPanelTemplate>
            <WrapPanel Background="Transparent" 
                Width="{Binding (FrameworkElement.ActualWidth), RelativeSource={RelativeSource AncestorType=ScrollContentPresenter}}" 
                ItemWidth="{Binding (ListView.View).ItemWidth, RelativeSource={RelativeSource AncestorType=ListView}}" 
                MinWidth="{Binding ItemWidth, RelativeSource={RelativeSource Self}}" 
                ItemHeight="{Binding (ListView.View).ItemHeight, RelativeSource={RelativeSource AncestorType=ListView}}" />
        </ItemsPanelTemplate>
    </ListView.ItemsPanel>
</ListView>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T22:12:41+00:00Added an answer on June 13, 2026 at 10:12 pm

    You are mixing MVVM and code behind.

    You should create a command behavior (Link) to label. Then you should bind CommandParameter to AccObject, and Command to the action you need to execute.

    Following should be removed.

    MouseDoubleClick="lbl_MouseDoubleClick"
    

    Updated as per comments

    As current item is bound to AccObject, simply use Binding in command parameter.

    CommandParameter = {Binding}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created custom listview in that have list of textview & list of
I have a ListView with a custom list adapter (that extends BaseAdapter). My list
I'm trying to sort the list items, I'm using custom listview. In this i
I have a activity which showing the 20 items in listview, at bottom list
I have a listview with custom rows and that extends SimpleAdapter. Each row consist
I'm using ListView to show search results. I have a Coustomized arrayListAdapter which returns
I have following situation: I have a custom ListView with ImageView and TextView in
I have created a multiple contacts picker in which i am showing list of
On my main form I have a ListView that contains a list in LargeIcon
In my app I have a listview with news items showing only a summary,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.