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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:09:41+00:00 2026-05-21T09:09:41+00:00

I have a button in my Header of the HeaderedContentControl When i click on

  • 0

I have a button in my Header of the HeaderedContentControl When i click on the button the command fires properly, but because the actual listboxitem isnt selected I have no data to work with. How do I cause the HeaderedContentControl be selected when a child control is selected or interacted with first?

Here is my control

<ListBox  x:Name="SearchList"
                      Grid.Row="1"
                      Grid.Column="0"
                      Background="Transparent"
                      BorderThickness="0"
                      ItemsSource="{Binding Path=SearchResults}"
                      SelectedItem="{Binding Path=SelectedResult,Mode=TwoWay,Converter={StaticResource DebugConverter}}"
                      HorizontalContentAlignment="Stretch"
                      HorizontalAlignment="Stretch"
                      ScrollViewer.VerticalScrollBarVisibility="Visible" >
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Border Width="600"
                                Margin="20,2,0,0"
                                Style="{StaticResource BorderStyle}">
                            <sb:BindingHelper.Binding>
                                <sb:BindingList>
                                    <sb:RelativeSourceBinding TargetProperty="Background"
                                                              RelativeMode="FindAncestor"
                                                              AncestorType="ListBoxItem"
                                                              Converter="{StaticResource DebugConverter}"
                                                              ConverterParameter="AlternatingRows" />
                                </sb:BindingList>
                            </sb:BindingHelper.Binding>
                            <toolkit:HeaderedContentControl IsTabStop="True">
                                <toolkit:HeaderedContentControl.Header>
                                    <Grid Width="575"
                                          Margin="5,5,10,0">
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="*" />
                                            <ColumnDefinition Width="100" />
                                            <ColumnDefinition Width="100" />
                                            <ColumnDefinition Width="100" />
                                        </Grid.ColumnDefinitions>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*" />
                                        </Grid.RowDefinitions>
                                        <TextBlock Grid.Column="0"
                                                   Grid.Row="0"
                                                   Text="{Binding Path=PatientName}"
                                                   HorizontalAlignment="Left"
                                                   Margin="0" />
                                        <Button Grid.Column="3"
                                                Grid.Row="0"
                                                Content="Complete Survey"
                                                IsTabStop="False">
                                            <sb:BindingHelper.Binding>
                                                <sb:BindingList>
                                                    <sb:RelativeSourceBinding Path="DataContext.OpenSurveyCommand"
                                                                              TargetProperty="Command"
                                                                              RelativeMode="FindAncestor"
                                                                              AncestorType="ListBox"
                                                                              Converter="{StaticResource DebugConverter}"
                                                                              ConverterParameter="SurveyCommandButton" />
                                                    <sb:RelativeSourceBinding Path="DataContext.HasFocus"
                                                                              TargetProperty="Focus" />

                                                </sb:BindingList>
                                            </sb:BindingHelper.Binding>
                                        </Button>
                                    </Grid>
                                </toolkit:HeaderedContentControl.Header>
                                <sb:BindingHelper.Binding>
                                    <sb:RelativeSourceBinding TargetProperty="IsExpanded"
                                                              Path="IsSelected"
                                                              RelativeMode="FindAncestor"
                                                              AncestorType="ListBoxItem"
                                                              BindingMode="TwoWay" />
                                </sb:BindingHelper.Binding>
                                <Grid Margin="5,2,0,2">
                                    <Grid.RowDefinitions>
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                        <RowDefinition />
                                    </Grid.RowDefinitions>
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="275" />
                                        <ColumnDefinition Width="250" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock  Grid.Row="0"
                                                Grid.Column="0"
                                                Text="{Binding MRN,Converter={StaticResource StringLabelConverter},ConverterParameter=MRN}" />
                                    <TextBlock Grid.Row="1"
                                               Grid.Column="0"
                                               Style="{StaticResource SearchResultsTextBlockStyle }"
                                               Text="{Binding OriginalVisitNumber,Converter={StaticResource StringLabelConverter},ConverterParameter='Original Visit Number'}" />
                                    <TextBlock Grid.Row="2"
                                               Grid.Column="0"
                                               Style="{StaticResource SearchResultsTextBlockStyle }"
                                               Text="{Binding OriginalAdmitDate,Converter={StaticResource StringLabelConverter},ConverterParameter='Original Admit Date'}" />
                                    <TextBlock Grid.Row="3"
                                               Grid.Column="0"
                                               Style="{StaticResource SearchResultsTextBlockStyle }"
                                               Text="{Binding OriginalReason,Converter={StaticResource StringLabelConverter},ConverterParameter='Original Reason'}" />
                                    <TextBlock Grid.Row="1"
                                               Grid.Column="1"
                                               Style="{StaticResource SearchResultsTextBlockStyle }"
                                               Text="{Binding ReAdmitVisitNumber,Converter={StaticResource StringLabelConverter},ConverterParameter='ReAdmit Visit Number'}" />
                                    <TextBlock Grid.Row="2"
                                               Grid.Column="1"
                                               Style="{StaticResource SearchResultsTextBlockStyle }"
                                               Text="{Binding ReAdmitDate,Converter={StaticResource StringLabelConverter},ConverterParameter='Readmit Date'}" />
                                    <TextBlock Grid.Row="3"
                                               Grid.Column="1"
                                               Style="{StaticResource SearchResultsTextBlockStyle }"
                                               Text="{Binding ReAdmitReason,Converter={StaticResource StringLabelConverter},ConverterParameter='ReAdmit Reason'}" />
                                </Grid>

                            </toolkit:HeaderedContentControl>
                        </Border>

                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
  • 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-21T09:09:42+00:00Added an answer on May 21, 2026 at 9:09 am

    The actual fix involved some code shuffling, i moved the actual results list objects into a collection of viewModels and put the code for the button command in that viewModel as opposed to the parent VM. This allows for much more flexibility.

    using System.Windows.Input;
    using GalaSoft.MvvmLight;
    using GalaSoft.MvvmLight.Command;
    using GalaSoft.MvvmLight.Messaging;
    using WavelengthIS.Silverlight.Core.Helpers;
    
    namespace ReadmissionTrackingApplication.Client.ViewModel
    {
        /// <summary>
        /// This class contains properties that a View can data bind to.
        /// <para>
        /// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
        /// </para>
        /// <para>
        /// You can also use Blend to data bind with the tool's support.
        /// </para>
        /// <para>
        /// See http://www.galasoft.ch/mvvm/getstarted
        /// </para>
        /// </summary>
        public partial class ReadmitPatientListViewModel : ViewModelBase
        {
            /// <summary>
            /// Initializes a new instance of the ReadmitPatientListViewModel class.
            /// </summary>
    
            ////public override void Cleanup()
            ////{
            ////    // Clean own resources if needed
    
            ////    base.Cleanup();
            ////}
    
            #region Declarations
    
            ICommand _openSurveyCommand;
            Messenger _messenger = Messenger.Default;
    
            #endregion
    
            #region Command Properties
            public ICommand OpenSurveyCommand
            {
                get
                {
                    if (_openSurveyCommand == null)
                    {
                        _openSurveyCommand = new RelayCommand(() => OnSurveyCommandExecute());
                    }
                    return _openSurveyCommand;
                }
                private set { }
            }
            #endregion
    
            #region Command Methods
            private void OnSurveyCommandExecute()
            {
                Wait.Begin("Loading Patient List...");
                _messenger.Send<ReadmitPatientListViewModel>(this);
                _messenger.Send<Messages.NavigationRequest<SubClasses.URI.PageURI>>(GetNavRequest_QUESTIONAIRRESHELL());
    
            }
            #endregion
    
            #region Properties
    
            #endregion
    
    
            private static Messages.NavigationRequest<SubClasses.URI.PageURI> GetNavRequest_QUESTIONAIRRESHELL()
            {
                Messages.NavigationRequest<SubClasses.URI.PageURI> navRequest =
                    new Messages.NavigationRequest<SubClasses.URI.PageURI>(
                        new SubClasses.URI.PageURI(Helpers.PageLinks.QUESTIONAIRRESHELL, System.UriKind.Relative));
                return navRequest;
            }
    
            partial void OnCreated()
            {
    
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page with a button that when I click, it retrieves data
I have a Jquery Mobile page. In my header I have a button to
I have button which post values of form to url but during post i
I have button, which fires an event, that deletes a record from the database.
I have one issue with UInavigationcontroller In my firstview i have button.If i click
I have a button, where I set its image and its selected & highlighted
I use the modern theme I have a livechat button on the header and
I have this button in header that I include in many page: <input type=button
On my blog I have a global Like button in the header embedded with
I have a button on my TableView header that is an empty box, and

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.