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 5930867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:36:48+00:00 2026-05-22T14:36:48+00:00

<listbox> <ListBox.ItemTemplate> <DataTemplate> <Grid Height=120 Width=480 VerticalAlignment=Top> <Grid.ColumnDefinitions> <ColumnDefinition Width=110/> <ColumnDefinition Width=*/> </Grid.ColumnDefinitions> <Border

  • 0
        <listbox> 
            <ListBox.ItemTemplate>
                <DataTemplate>

                    <Grid Height="120" Width="480" VerticalAlignment="Top">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="110"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Border 
                            Height="105" 
                            Width="110" 
                            BorderBrush="White" 
                            Grid.Column="0" 
                            BorderThickness="2">
                            <Image 
                                delay:LowProfileImageLoader.UriSource="{Binding Path=Avatar}" 
                                Source="/Image/default-thumb-groups.png">
                            </Image>
                        </Border>

                        <Grid Grid.Column="1">

                            <Grid.RowDefinitions>
                                <RowDefinition Height="4"/>
                                <RowDefinition Height="35"/>
                                <RowDefinition Height="50"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="10" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <TextBlock 
                                Text="{Binding Path=Name,Mode=TwoWay}"  
                                Grid.Column="1" 
                                Grid.Row="1" 
                                FontFamily="Segoe WP Light" 
                                FontSize="26"
                                Foreground="{StaticResource PhoneForegroundBrush}" 
                                TextWrapping="Wrap">
                            </TextBlock>

                            <TextBlock 
                                Text="{Binding Path=Members,Mode=TwoWay}"   
                                Grid.Column="2"  
                                Grid.Row="2" 
                                FontFamily="Segoe WP Light" 
                                HorizontalAlignment="Left" 
                                FontSize="20" Opacity="0.91"
                                Foreground="{StaticResource PhoneForegroundBrush}" 
                                TextWrapping="Wrap">
                            </TextBlock>

                            <toolkit:ContextMenuService.ContextMenu>
                                <toolkit:ContextMenu 
                                    Name="DeleteGroup" 
                                    IsZoomEnabled="False" 
                                    Tag="{Binding Nid,Mode=TwoWay}" 
                                    Visibility="{Binding ElementName=GroupList,  Path=DataContext.DeleteStatus,Mode=TwoWay, Converter=
                                               {StaticResource booleanToVisibility}}" Opened="DeleteGroup_Opened" Closed="DeleteGroup_Opened">

                                    <toolkit:MenuItem Header="delete group">
                                        <Interactivity:Interaction.Triggers>
                                            <Interactivity:EventTrigger EventName="Click">
                                                <Command:EventToCommand Command="{Binding ElementName=GroupList, 
                                                    Path=DataContext.DeleteCommand,Mode=TwoWay}"  CommandParameter="{Binding 
                                                    ElementName=DeleteGroup}" PassEventArgsToCommand="True"/>
                                            </Interactivity:EventTrigger>
                                        </Interactivity:Interaction.Triggers>
                                    </toolkit:MenuItem>
                                </toolkit:ContextMenu>
                            </toolkit:ContextMenuService.ContextMenu>
                        </Grid>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

While trying for cleanup ; The Trigger of Context menu is not Detaching ; Because of this that page is not Dying even after navigating back from the page. This causing Saviour memory issue in our page. Please help me to resolve this Issue

  • 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-05-22T14:36:49+00:00Added an answer on May 22, 2026 at 2:36 pm

    Never worked with the Toolkit ContextMenu, but noticed that you are not the only one having similar problem. For example this article proves that “the ContextMenu control attaches itself to the RootVisual via mouse event handlers and therefore never gets GC’ed; even worse, the visual tree it is placed in is kept alive as well”. Even if that article talks about the desktop, the symptoms are probably the same on WP7.

    I would try to create/destroy menu programatically. This article demonstrates the techniques that can be used.

    Another possibility would be to customize the listbox:

    • Override PrepareContainerForItemOverride: Call base.PrepareContainerForItemOverride() to get the standard ListBoxItem and add ContextMenu to it manually.
    • Override ClearContainerForItemOverride to clear the menu reference.

    (Never tried that, but it should work.)

    A side remark

    Your Xaml seems to be overcomplicated to me. If nothing else, then using nested grids within ListBoxItem (which in turn is embedded into ListBox panel (VirtualizingStackPanel), which is in at least one more panel on the page level) must have terrible perf impact.
    Even if I forget that the internal 4×2 grid uses 2 cells only (perhaps you simplified presented Xaml), what’s the purpose of the outer grid? The same effect can be achieved by using a single grid and column span over the first column.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have the following DataTemplate for a ListBox.ItemTemplate : <DataTemplate x:Key=Tweet> <Grid> <Grid.ColumnDefinitions>
So I have this Xaml inside a ListBox Item Template: <ListBox.ItemTemplate> <DataTemplate> <Grid Height=22
<ListBox.ItemTemplate> <DataTemplate> <Grid x:Name=grid> <Grid.Background> <SolidColorBrush x:Name=backgroundBrush Color=Transparent Opacity=0.1/> </Grid.Background> </Grid> <DataTemplate.Triggers> <DataTrigger Binding={Binding
I have this: <ListBox x:Name=PART_lstAttributes Grid.Row=1 Style={StaticResource GlossyBlackListBox}> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock x:Name=txtAttributeName Text={Binding
I have a problem with layout <ListBox Name=Tweets Grid.Row=1 ItemsSource={Binding Path=Tweets} Background=#1F0000FE> <ListBox.ItemTemplate> <DataTemplate>
I have a listbox, with custom items. Code: <ListBox Height=600 HorizontalAlignment=Left Margin=7,6,0,0 Name=friendList VerticalAlignment=Top
I have a databound and itemtemplated ListBox: <ListBox x:Name=lbLista ScrollViewer.VerticalScrollBarVisibility=Visible> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation=Horizontal>
People use frequently something like: <ListBox ItemsSource={Binding ElementName=thisControl, Path=ListIndexes}> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <Label Content={Binding
I have a listbox, and I have the following ItemTemplate for it: <DataTemplate x:Key=ScenarioItemTemplate>
I'm developing a Windows Phone application. I have defined a ListBox.ItemTemplate's DataTemplate as follows:

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.