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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:48:04+00:00 2026-05-17T23:48:04+00:00

i am doing : <Button Style={StaticResource buttonstyle} HorizontalAlignment=Left Margin=12,21,10,0 VerticalAlignment=Top Height=78 Width=83 BorderThickness=2 Content=add

  • 0

i am doing :

       <Button 
            Style="{StaticResource buttonstyle}"
            HorizontalAlignment="Left" Margin="12,21,10,0" 
            VerticalAlignment="Top" Height="78" Width="83" 
            BorderThickness="2" Content="add event"
            Command="{Binding NewEvent}" 
            CommandParameter="This is the report."
        >
        </Button>

where command is :

   public class StringDelegateCommand : ICommand 
{ 
    //methodes without return value
    Action<string> m_ExecuteTargets = delegate { };
    //methodes without parmtters inside
    Func<bool> m_CanExecuteTargets = delegate { return false; };
    //the value whom allows execution 
    bool m_Enabled = false;


    #region ICommand Members

    public bool CanExecute(object parameter)
    {
        Delegate[] targets = m_CanExecuteTargets.GetInvocationList();
        foreach (Func<bool> target in targets)
        {
            m_Enabled = false;
            bool localEnable = target.Invoke();
            if (localEnable)
            {
                m_Enabled = true;
                break;
            }
        }
        return m_Enabled;
    }

    public event EventHandler CanExecuteChanged = delegate { };

    public void Execute(object parameter)
    {
        if (m_Enabled)
            m_ExecuteTargets(parameter != null ? parameter.ToString() : null);
    }

    #endregion

    public event Action<string> ExecuteTargets
    {
        add
        {
            m_ExecuteTargets += value;
        }
        remove
        {
            m_ExecuteTargets -= value;
        }
    }

    public event Func<bool> CanExecuteTargets
    {
        add
        {
            m_CanExecuteTargets += value;
            CanExecuteChanged(this, EventArgs.Empty);
        }

        remove
        {
            m_CanExecuteTargets -= value;
            CanExecuteChanged(this, EventArgs.Empty);
        }
    }
}

and in my view model (which is binded in context so things do bind !!!):

 //called in ctor where newEvent is defined : StringDelegateCommand newEvent; 
     private void setNewEventCommand()
    {
        newEvent = new StringDelegateCommand();
        newEvent.CanExecuteTargets += isThereAnotherNewEvent;
        newEvent.ExecuteTargets += exacuteNewEvent;
        NewEvent = newEvent; 
    }

    void exacuteNewEvent(string message)
    {
        Window1 w = new Window1();
        w.ShowDialog();

    }

When I click on the button nothing happenes , what am I doing wrong ?can someone help me understand my error…

thank you …

EDIT i should mention this is what the compliler writes :

System.Windows.Data Error: 40 : BindingExpression path error: ‘NewEvent’ property not found on ‘object’ ”viewModel’ (HashCode=18612316)’. BindingExpression:Path=NewEvent; DataItem=’viewModel’ (HashCode=18612316); target element is ‘Button’ (Name=”); target property is ‘Command’ (type ‘ICommand’)

  • 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-17T23:48:04+00:00Added an answer on May 17, 2026 at 11:48 pm

    The problem was solved: the property should have been public and then everything works just fine.

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

Sidebar

Related Questions

I am adding a button into UITableView by doing the following // Add checkOut
When doing something like this: <div style=float: left;>Left Div</div> <div style=float: right;>Right Div</div> I
When I run this code var button=document.getElementById(button) if (navigator.userAgent.indexOf('iPhone') != -1) { button.style.left =
my control template and style: <ControlTemplate TargetType={x:Type Button} x:Key=ImageButtonTemplate> <Image Source=..//..//images//ok.png Width={TemplateBinding Width} Height={TemplateBinding
<asp:Button ID=btnOK runat=server Text=Send Width=80px CssClass=ButtonClass style=color:Red;/> I've tried adding a class and the
I am doing this in order to have Facebook like button in my page:
I find myself doing this repeatedy. $jq(button).filter(function(){ return this.id.match(/^user_(\d+)_edit$/); }).click(function(){ var matches = this.id.match(/^user_(\d+)_edit$/);
I am doing newsletter subscription.I have 2radio buttons-subscribe and unsubscibe and a submit button.But
I have a submit button where I want a confirmation pop-up, doing this works
When I click the button, alerts aren't performed. What am I doing wrong? Maybe

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.