wpf - Prism Delegate command not enabling button -



wpf - Prism Delegate command not enabling button -

i trying enable , disable button in wpf (prism) user command based on info entered user.

in constructor submitcommand = new delegatecommand<object>(onsubmit, cansubmit); public icommand submitcommand { get; private set; } private void onsubmit(object arg) { _logger.log(arg.tostring()); } private bool cansubmit(object arg) { homecoming title.length > 0; } private string _title=""; public string title { { homecoming _title; } set { if (_title != value) { _title = value; this.raisepropertychanged(); } } }

i bound submitcommand in xaml below

<button content="submit" width="100" command="{binding path=submitcommand}" commandparameter="{binding elementname=titletext, path=text}" />

the issue when title value changes, button not enabled. may missing something. help!

it sounds you're needing raise canexecutechanged event on command. more details, see http://wpftutorial.net/delegatecommand.html , http://msdn.microsoft.com/en-us/library/system.windows.input.icommand.canexecutechanged.aspx

note first link implementation of delegatecommand, , not you're using. prism delegatecommand, need phone call raisecanexecutechanged() method when want determine whether button should reenabled.

good luck!

nate

wpf prism

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -