mvvm - WPF Passing Multiple Parameters on Click of Checkbox -
following xaml:
<checkbox name="checkboxnofindings" content="no findings" command="{binding disablertecommand}" commandparameter="{binding path=content}" grid.row="1" grid.column="1" margin="2,5,0,3" />
i want pass both ischecked
, content
property values command parameter , access vm.
vm code:
private void disablerte(object args) { if (null != args) { string rtename = args.tostring(); } }
actual requirement is, on check chekbox, textbox should disabled , content of checkbox should applied text of texbox. , opposite side , on uncheck checkbox textbox should enabled , text should empty.
any solution scenario?
hmm, way want done, seems bit odd me. why don't implement "easy way" in vm? e.g.
public class checkboxexamplevm : viewmodelbase //assuming have such base class { private bool? _ischecked; public bool? ischecked { { return _ischecked; } set { _ischecked = value; modifytextvalue(value); raisepropertychanged("ischecked"); } } private string _textvalue; public string textvalue { { return _textvalue; } set { _textvalue = value; raisepropertychanged("textvalue"); } } private void modifytextvalue(bool? condition) { // ever want text value } }
now need set bindings , fine.
another option, using converter , element binding, don't have implement in vm itself.
Comments
Post a Comment