Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are several way to achieve this.</p> <p>One of the simplest is the way you've already identified yourself - e.g. to bind the SecurityLabelConstraint directly - e.g. using <code>Tibet</code> binding:</p> <pre><code>set.Bind(SecurityLabelConstraint) .For(p =&gt; p.Constant) .To("If(info.IsAdmin, 20, 0)"); </code></pre> <p>Alternatively if there is complicated logic needed (beyond the scope or performance of the Tibet binding engine) then you can implement the binding to a property on your cell - or on to an intermediate object.</p> <p>For example, you could have a Wrapper class which implements:</p> <pre><code> public class Wrapper { private NSLayoutConstraint _constraint; public Wrapper(NSLayoutConstraint constraint) { _constraint = constraint; } private string _foo; public string Foo { get { return _foo; } set { _foo = value; // your complex logic on _constraint goes here } } } </code></pre> <p>If you store a <code>_wrapper</code> instance in a field on the cell, then this can be bound as:</p> <pre><code>set.Bind(_wrapper) .For(p =&gt; p.Foo) .To(info =&gt; info.IsAdmin); </code></pre> <p>If you had instead put the Foo property on the cell, then you could have used:</p> <pre><code>set.Bind() .For(cell =&gt; cell.Foo) .To(info =&gt; info.IsAdmin); </code></pre> <p>One final way to achieve the binding is to try to hook into the cell's <code>DataContext</code> directly and to use the <code>PropertyChanged</code> handler - I don't recommend this as it tends to get a bit fiddly to maintain and as it's easy to create memory leaks when accessing NSObject's inside event callbacks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload