Xamarin.Forms MVVM - Is there a way to Unset a Binding? - mvvm

Is there a way to programmatically unset a binding? Something like:
myLabel.UnsetBinding(Label.TextColorProperty);
Surely there's gotta be a way to do this?

You are looking for the RemoveBinding() method: https://developer.xamarin.com/api/member/Xamarin.Forms.BindableObject.RemoveBinding/p/Xamarin.Forms.BindableProperty/
For your example:
myLabel.RemoveBinding(Label.TextColorProperty);

A Binding is attached to a BindableProperty, not a class.
You can just set the Property to anything else and the Binding will be gone;
myLabel.Text = String.Empty;
Note: The above (Keith's) is the correct answer.

Related

SAPUI5 - How do I disable text input in DateRangeSelection

I need to completely disable text entry on a DateRangeSelection, so that only the calendar selection can be accepted..
I can the disable text input for a DatePicker component with...
view.byId("__reportDate")._bMobile = true;
Unfortunately this doesn't work for a DateRangeSelection.
Is there anything else I can try?
There does not seem to be a standard property to do it, you can however tweak the underlying input element used to set it to readonly. This would disable any text input in the field. This might be one of the ways to do it.
var oDateSel = this.getView().byId("dateSel");
$("#"+oDateSel.sId+" input").prop("readonly",true);
Note: This is certainly not a standard approach according to the UI5 standards. Also you might have to set a handler to set the element to readonly if the control is re-rendered.
Solution was...
var dateSel = sap.ui.getCore().byId("dateRange");
$("#"+dateSel.sId+" input").prop("disabled",true);
(readonly wiped out the placeholder in IE).

How do I access GET/POST from a view helper?

I have a custom content element which uses a view-helper that inherits from link action. I want to use specific CSS when this link is "active". One way to do this would be to read _GET and check for link variables. Can I access _GET in a sane way from a view-helper? Or is there a better way?
Maybe this is impossible because the output of the view-helper will be cached...
I could of course access $_GET directly, but will this work with RealUrl?
Of course you can, the same way as you would do it within controller:
$fooInGet = \TYPO3\CMS\Core\Utility\GeneralUtility::_GET('foo');
$barInPost = \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('bar');
$zeeAnywhere = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('zee');

jQuery styling tricks -Check for a class name

I would like to check whether the particular sytle / class has already been applied on given element.
What is the correct jQuery function to check this?
Use .hasClass()
The Syntax is
$(selector).hasClass(classname)
Just use hasClass();
$('#mydiv').hasClass('testClass');
ie...
if($('#mydiv').hasClass('testClass')){ //YOUR CODE HERE if TRUE }

silverstripe shortcode return dynamic template

I followed this instruction to be able to include a variable in the Content Field (HTMLEditor) of a Page - so that the variable can be replaced with other content:
http://www.balbuss.com/mini-introduction-to-shortcodes/
I want to display a list of dataobjects within the $Content.
Sadly the DummyHandler in the instruction is static. So I canĀ“t access the Controller in it, to let him do something (generate the list.)
Is there a solution to access the controller in a static function or maybe is there another better way to put a variable in the $Content.
Thx,
Florian
Controller::curr() is probably what you are after?
To use in conjunction with Controller::hasCurr(), as no controller would mean an error when using Controller::curr()
See https://github.com/silverstripe/sapphire/blob/3.0/control/Controller.php#L384

zend form - Element Label in two line

I am extremely new to Zend Framework, In registration form, i need label text in two line. For Example:- In the case First name, I need to display like below:
First
Name:
How can i implement this? Please anyone help me!!!
By default, input fields labels are being escaped by Zend_View_Helper_FormLabel. However, you can easy switch this off:
$yourTextInputElement->getDecorator('label')->setOption('escape', false);
This way you can use labels as e.g. $yourTextInputElement->setLabel('First <br/> name');.
What about this nifty solution ?
http://jsfiddle.net/J67GD/
The best way is probably to use Description decorator, or subclass one of other standard ZF decorators.
Yanick's CSS solution might be a good choice too, depending what are you trying to do.