View Issue Details

IDProjectCategoryView StatusLast Update
0001616NoesisGUIUnity3Dpublic2020-04-21 16:26
ReporterGwynnethAssigned Tosfernandez 
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
Product Version2.2.6 
Target Version3.0Fixed in Version 
Summary0001616: TextDecoration cannot be bound with a ValueConverter specified in the binding
DescriptionUsing a TextBlock with a binding to a TextDecoration property will work. If a ValueConverter is specified in the binding it will not and log the error below. Furthermore, TextDecoration only seems to implement Underline and the TextBox does not have the TextDecoration property exposed. I assume that this is by design and has nothing to do with the error?

<code>

InvalidOperationException: Can't unbox native pointer
Noesis.Extend.Unbox (System.IntPtr cPtr, Noesis.Extend+NativeTypeInfo info) (at Assets/NoesisGUI/Plugins/API/Core/ExtendBoxing.cs:233)
Noesis.Extend.GetProxy (System.IntPtr nativeType, System.IntPtr cPtr, System.Boolean ownMemory) (at Assets/NoesisGUI/Plugins/API/Core/Extend.cs:507)
Noesis.Extend.ConverterConvert (System.IntPtr cPtr, System.IntPtr valType, System.IntPtr valPtr, System.IntPtr targetTypePtr, System.IntPtr paramType, System.IntPtr paramPtr, System.IntPtr& result) (at Assets/NoesisGUI/Plugins/API/Core/Extend.cs:2038)
UnityEngine.Debug:LogException(Exception)
NoesisUnity:OnUnhandledException(Exception) (at Assets/NoesisGUI/Plugins/NoesisUnity.cs:142)
Noesis.Error:UnhandledException(Exception) (at Assets/NoesisGUI/Plugins/API/Core/Error.cs:18)
Noesis.Extend:ConverterConvert(IntPtr, IntPtr, IntPtr, IntPtr, IntPtr, IntPtr, IntPtr&) (at Assets/NoesisGUI/Plugins/API/Core/Extend.cs:2058)
Noesis.View:Noesis_View_Create(HandleRef)
Noesis.View:CreateCPtr(Type, Boolean&) (at Assets/NoesisGUI/Plugins/API/Core/View.cs:467)
Noesis.BaseComponent:.ctor() (at Assets/NoesisGUI/Plugins/API/Proxies/BaseComponentExtend.cs:17)
Noesis.DispatcherObject:.ctor() (at Assets/NoesisGUI/Plugins/API/Proxies/DispatcherObject.cs:30)
Noesis.View:.ctor(HandleRef) (at Assets/NoesisGUI/Plugins/API/Core/View.cs:451)
Noesis.View:.ctor(FrameworkElement) (at Assets/NoesisGUI/Plugins/API/Core/View.cs:419)
NoesisView:CreateView(FrameworkElement) (at Assets/NoesisGUI/Plugins/NoesisView.cs:1302)
NoesisView:LoadXaml(Boolean) (at Assets/NoesisGUI/Plugins/NoesisView.cs:394)
NoesisView:OnEnable() (at Assets/NoesisGUI/Plugins/NoesisView.cs:453)

</code>
Steps To ReproduceSpecify XAML, ValueConverter and ViewModel as below. The first TextBlock will show text with underline, the second textblock will not.

<code>
        <TextBlock Grid.Row="2" FontSize="50" Text="Hello, from stock TextBlock!" FontFamily="Arial" FontWeight="Bold" FontStyle="Italic" TextDecorations="{Binding TextDecoration}"/>
        <TextBlock Grid.Row="3" FontSize="50" Text="Hello, from stock TextBlock with ValueConverter!" FontFamily="Arial" FontWeight="Bold" FontStyle="Italic" TextDecorations="{Binding TextDecoration, Converter={StaticResource TextDecorationConverterSimple}}"/>
</code>

<code>
using System;
using System.Globalization;


#if NOESIS
using TDO = Noesis.TextDecorations;
using Noesis;
#else
using TDO = System.Windows.TextDecorations;
using System.Windows.Data;
#endif


namespace Test_TextBlockBinding.UI_Customization.Controls.ValueConverters {
    public class TextDecorationConverterSimple : IValueConverter {


        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {


#if NOESIS
            return TDO.Underline;
#else
            return TDO.Underline;
#endif


        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
            throw new NotImplementedException();
        }


    }
}

</code>

<code>

#if NOESIS
using TDO = Noesis.TextDecorations;
using Noesis;
#else
using TDO = System.Windows.TextDecorationCollection;
using System.Windows;
#endif


namespace Test_TextBlockBinding.ViewModels {
    public class ViewModel : NotifyPropertyChangedObject {

        private TDO _textDecoration;
        public TDO TextDecoration {
            get => _textDecoration;
            set => SetProperty(ref _textDecoration, value);
        }
}

</code>
TagsTextDecoration, ValueConverter
PlatformAny

Activities

sfernandez

sfernandez

2020-01-16 12:47

manager   ~0006076

Created a ticket for TextBox.TextDecorations missing property: 0001619

Issue History

Date Modified Username Field Change
2020-01-13 10:49 Gwynneth New Issue
2020-01-13 10:49 Gwynneth Tag Attached: TextDecoration
2020-01-13 10:49 Gwynneth Tag Attached: ValueConverter
2020-01-13 10:50 Gwynneth Steps to Reproduce Updated View Revisions
2020-01-16 12:42 sfernandez Assigned To => sfernandez
2020-01-16 12:42 sfernandez Status new => assigned
2020-01-16 12:42 sfernandez Target Version => 3.0.0
2020-01-16 12:47 sfernandez Note Added: 0006076
2020-04-21 16:26 jsantos Target Version 3.0.0 => 3.0