This question is locked. New answers and comments are not allowed.
I have the following style applied to my TreeListView component, using the static resources below:
The FontStyle style is applied as expected to each row, but the FontWeight causes an exception whenever either MyProperty2 changes, or when a node is folded closed. The exception is a TargetInvocationException raised from an ArgumentOutOfRange exception
The inner exception says that parameter "weight" is out of range
In addition, when I substitute MyProperty2 with MyProperty1 in the FontWeight style, the error still occurs.
Debugger breakpoint in the converter, however, shows tht it returns either FontWeights.Bold or FontWeights.Normal.
<sw:FontWeight x:Key="NormalWeight">Normal</sw:FontWeight><sw:FontWeight x:Key="BoldWeight">Bold</sw:FontWeight><sw:FontStyle x:Key="NormalStyle">Normal</sw:FontStyle><Style x:Key="TemplateRow" TargetType="telerik:TreeListViewRow"> <Setter Property="FontSize" Value="10"/> <Setter Property="FontStyle" Value="{Binding Path=MyProperty1, Converter={StaticResource BooleanToFontEmphasisConverter}, FallbackValue={StaticResource NormalStyle}, TargetNullValue={StaticResource NormalStyle}}" /> <Setter Property="FontWeight" Value="{Binding Path=MyProperty2, Converter={StaticResource BooleanToFontWeightConverter}, FallbackValue={StaticResource NormalWeight}, TargetNullValue={StaticResource NormalWeight}}" /> <Setter Property="IsExpanded" Value="{Binding Expanded, Mode=TwoWay}" /> <Setter Property="IsSelected" Value="{Binding Selected, Mode=TwoWay}" /></Style>The FontStyle style is applied as expected to each row, but the FontWeight causes an exception whenever either MyProperty2 changes, or when a node is folded closed. The exception is a TargetInvocationException raised from an ArgumentOutOfRange exception
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)at System.Delegate.DynamicInvokeImpl(Object[] args)at System.Delegate.DynamicInvoke(Object[] args)at TemplatesListTreexaml.BindingOperation(Object BindingState, Int32 , Action )à System.Windows.FontWeights.EnsureFontWeight(FontWeightType weight)at MS.Internal.XcpImports.TryConvertPseudoEnum(RuntimeTypeHandle typeHandle, Int32 value, Object& result)at MS.Internal.XcpImports.ConvertCValueForManagedWithType(Type propertyType, CValue& outVal, Int32 outDOType, Boolean releaseObjectReference, Boolean deleteBuffer, IManagedPeerBase fromObject)at MS.Internal.XcpImports.GetValue(IManagedPeerBase managedPeer, DependencyProperty property)at System.Windows.DependencyObject.GetOldValue(DependencyProperty property, EffectiveValueEntry& oldEntry)at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, ValueOperation operation)at System.Windows.DependencyObject.RefreshExpression(DependencyProperty dp)at System.Windows.Data.BindingExpression.SendDataToTarget()at System.Windows.Data.BindingExpression.SourceAcquired()at System.Windows.Data.Debugging.BindingBreakPoint.<>c__DisplayClass4.<BreakOnSharedType>b__3()In addition, when I substitute MyProperty2 with MyProperty1 in the FontWeight style, the error still occurs.
Debugger breakpoint in the converter, however, shows tht it returns either FontWeights.Bold or FontWeights.Normal.