Note that there are some explanatory texts on larger screens.

plurals
  1. POWPF MultiBinding fails in Syncfusion TabItemExt header
    primarykey
    data
    text
    <p>I have a subclass of <code>TabItem</code> as follows, for which I'm trying to set the <code>Header</code> property. I've tried this with a <code>MultiBinding</code>:</p> <pre><code>&lt;DataEditPane x:TypeArguments="MyType" x:Class="MyDataEditPane"&gt; &lt;DataEditPane.Header&gt; &lt;MultiBinding StringFormat="Hello world {0} {1}"&gt; &lt;Binding Path="BoundVariable1" /&gt; &lt;Binding Path="BoundVariable2" /&gt; &lt;/MultiBinding&gt; &lt;/DataEditPane.Header&gt; &lt;/DataEditPane&gt; </code></pre> <p>But it fails as such:</p> <pre><code>System.Windows.Data Error: 28 : MultiBinding failed because it has no valid Converter. MultiBindingExpression:target element is 'MyDataEditPane' (Name=''); target property is 'Header' (type 'Object') System.Windows.Data Error: 28 : MultiBinding failed because it has no valid Converter. MultiBindingExpression:target element is 'MyDataEditPane' (Name=''); target property is 'Header' (type 'Object') </code></pre> <p>I'd always thought the <code>StringFormat</code> served the role of the converter, but perhaps not?</p> <p>Wrapping the fields together in some kind of container, like a <code>Label</code>, also doesn't seem to work:</p> <pre><code>&lt;DataEditPane x:TypeArguments="MyType" x:Class="MyDataEditPane"&gt; &lt;DataEditPane.Header&gt; &lt;Label&gt; &lt;Label.Text&gt; &lt;MultiBinding StringFormat="Hello world {0} {1}"&gt; &lt;Binding Path="BoundVariable1" /&gt; &lt;Binding Path="BoundVariable2" /&gt; &lt;/MultiBinding&gt; &lt;/Label.Text&gt; &lt;/Label&gt; &lt;/DataEditPane.Header&gt; &lt;/DataEditPane&gt; </code></pre> <p>In this case, the <code>.ToString()</code> representation of the label ("<code>System.Windows.Controls.Label</code>") is shown as the header.</p> <p>Note that a single binding works just fine:</p> <pre><code>&lt;DataEditPane x:TypeArguments="MyType" x:Class="MyDataEditPane"&gt; &lt;DataEditPane.Header&gt; &lt;Binding Path="BoundVariable1" /&gt; &lt;/DataEditPane.Header&gt; &lt;/DataEditPane&gt; </code></pre> <p>If it matters, I'm using the Syncfusion <code>TabItemExt</code> as one of my superclasses in the inheritance hierarchy, but as that class doesn't override the <code>Header</code> property I don't think that makes a difference.</p> <p>What am I doing wrong? I know I can make another property in the ViewModel to act as the Header (and then single-bind that) but I want to learn how to do this properly in XAML.</p>
    singulars
    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.
    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