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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:24:26+00:00 2026-05-26T10:24:26+00:00

I’m trying to use the search text box (which I made by following this

  • 0

I’m trying to use the search text box (which I made by following this tutorial: http://davidowens.wordpress.com/2009/02/18/wpf-search-text-box/).

I use MVVM & WPF. The above user control works when you write the “Search”-event in the code-behind file of the View, but I can’t get it to work with a command (using the ViewModel).

(The search-event fires when you haven’t typed something for about 2 seconds.)

I’ve tried using Caliburn, so it can “map” the view event to the viewmodel method. However when the event fires, the application crashes: “No target found for method SearchText().” on the RaiseSearchEvent method from the custom user control.

See the following test application: Test application

Could somebody tell me what I’m doing wrong? I told CaliBurn to do the following:

<i:Interaction.Triggers>
        <i:EventTrigger EventName="Search">
            <cal:ActionMessage MethodName="SearchText()" />
        </i:EventTrigger>
</i:Interaction.Triggers>

So I figure this is correct. It means that when the “Search” event fires, caliburn will look for the method SearchText in the ViewModel. This doesn’t happen though, and it causes my app to crash and burn.

Do you know why? Or how I could solve this problem (doesn’t have to be with Caliburn).
I already tried adding “Extending Command Support” (http://msdn.microsoft.com/en-us/library/dd458928.aspx), but this is a little too complex for me :/

Thanks for any help!!

  • 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-26T10:24:27+00:00Added an answer on May 26, 2026 at 10:24 am

    You are using the Caliburn’s ActionMessage but because you do not use its Bootstrapper class to start up your application, the MainView’s DataContext is not set to an instance of the MainViewModel. If you check the SearchTextBox’s DataContext at runtime, you’ll see it’s null.

    Here’s a series of steps that may solve your problem (using your linked example project)

    Create a class called MyBootstrapper. It should look like this

    public class MyBootstrapper : Bootstrapper<MainViewModel> {}
    

    Add your new bootstrapper to the Application’s Resources collection, like I show below (App.xaml)

    <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:local="clr-namespace:WpfApplicationParadise"
                 x:Class="WpfApplicationParadise.App">
        <Application.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary>
                        <local:MyBootstrapper x:Key="bootstrapper" />
                    </ResourceDictionary>
                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
        </Application.Resources>
    </Application>
    

    Not sure why, but if the bootstrapper isn’t nested in my build, it never is instantiated when App.InitializeComponent() is run…

    Change App.xaml.cs to simply run InitializeComponent. Note that I had to tweak your build a bit to get this to work… InitializeComponent() is only defined in the App.g.cs file if you have the nested resource dictionary from step 2, or if you have an x:Name attribute on App.xaml, or perhaps other things…

    using System.Windows;
    
    namespace WpfApplicationParadise
    {
        public partial class App : Application
        {
            public App()
            {
                InitializeComponent();
            }
        }
    }
    

    Finally, you need to remove the parens as Wallstreet Programmer suggested.

    Those steps should cause your App to instantiate your bootstrapper, which in turn instantates the MainViewModel as the root viewmodel of your application, and then create a MainView and hook up its DataContext to the MainViewModel. At that point, your application should work as expected.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
This could be a duplicate question, but I have no idea what search terms
I'm trying to select an H1 element which is the second-child in its group
I have a text area in my form which accepts all possible characters from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example

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.