question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MultiBind on Textblock Text field fails in UWP

See original GitHub issue

Noticed that a multibind will fail consistently for me when bound in UWP to the Text field of a TextBlock, noting: Unhandled exception at 0x7757DF95 (combase.dll).

Sample code:

                <TextBlock Foreground="AntiqueWhite" FontSize="12" FontWeight="Bold" Text="13.41">
                        <Interactivity:Interaction.Behaviors>
                            <cimba:MultiBindingBehavior Converter="{StaticResource IntToValConverter}" 
                                                        PropertyName="Text"  >
                                <cimba:MultiBindingItem Value="{Binding StepValue}"/>
                            </cimba:MultiBindingBehavior>
                        </Interactivity:Interaction.Behaviors>
                </TextBlock>

And the Converter:

    public class IntToValConverter : MultiValueConverterBase
    {
        public override object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (null == values[0]) return "haha";
            return "hoho";
        }
        public override object[] ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
pedrolamascommented, Mar 29, 2016

Given it only happens on Release mode, we can safely assume this is due to .NET Native optimizations… I’m not sure I’ll be able to fix this on my side, but I think I have a solution for this specific case!

Add this to your app Default.rd.xml file, rebuild and try again:

<Type Name="Windows.UI.Xaml.Controls.TextBlock">
  <Property Name="Text" Serialize="Required"/>
</Type>
0reactions
pedrolamascommented, Mar 30, 2016

Yep, I don’t think I’ll be able to do “magic” stuff over this one, but I’m hoping Microsoft might! 😉

In the meantime, here’s something to read on the subject if you want to!

Read more comments on GitHub >

github_iconTop Results From Across the Web

MultiBind on Textblock Text field fails in UWP · Issue #52
Noticed that a multibind will fail consistently for me when bound in UWP to the Text field of a TextBlock, noting: Unhandled exception...
Read more >
Multi binding in UWP - xaml
A TextBlock item can consist of several "runs" of text which can bind to different properties. The runs will behave like inline elements....
Read more >
TextBox Binding doesn't work while focused (when using ...
TextBox Binding doesn't work while focused (when using uwp datagrid) The problem is when the user clicks save (a button on the command...
Read more >
How to bind fontsize of a textblock from two different ...
But I want to scale the Text at a specific Font Size because in Segoe UI, different Font Size have different letter looks...
Read more >
Comparison of Avalonia with WPF and UWP
Indicates the platform (defined by the Avalonia, WPF or UWP column) has the ... This allows for easily changing textbox direction and then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found