Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Unable to cast object of type 'MS.Internal.NamedObject'
Message
 
To
09/03/2013 13:28:29
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Miscellaneous
Thread ID:
01567887
Message ID:
01567921
Views:
19
No worries. Glad I could help


>Thanks Kevin,
>
>that made me double check the control names and I had them incorrect. Once I set them up correctly it the designer OK.
>
>I wish the error message was a bit more instructive though :(
>
>>Frank,
>>
>>First, does it run? Sometimes the designer craps out but the app still runs. If it runs, see what the Output window has to say.
>>
>>Have you tried to bind the textbox to each source individually? One of them is failing, and it would be helpful to see which one.
>>
>>
>>
>>>In Visual Studio 2010, I have a XAML screen with a textbox defined like this:
>>>
>>>
                        < TextBox  Name="txtBalanceOutstanding"
>>>                                  Grid.Row="9" Grid.Column="1" Grid.ColumnSpan="1" Height="23" 
>>>                                  HorizontalAlignment="Stretch" Margin="0,0,100,0" 
>>>                                  IsReadOnly="True" FontWeight="Bold" Focusable="False" VerticalContentAlignment="Center" >
>>>
>>>                        < /TextBox >
>>>
>>>
>>>
>>>When I change it to this (adding in the MultiBinding):
>>>
>>>
                        <TextBox  Name="txtBalanceOutstanding"
>>>                                  Grid.Row="9" Grid.Column="1" Grid.ColumnSpan="1" Height="23" 
>>>                                  HorizontalAlignment="Stretch" Margin="0,0,100,0" 
>>>                                  IsReadOnly="True" FontWeight="Bold" Focusable="False" VerticalContentAlignment="Center">
>>>                            <MultiBinding Converter="{StaticResource OutstandingBalanceConverter}">
>>>                                <Binding ElementName="txtDepositTotal" Path="Text"></Binding>
>>>                                <Binding ElementName="txtDep_Amount" Path="Text"></Binding>
>>>                            </MultiBinding>
>>>                        </TextBox>
>>>
>>>
>>>
>>>The screen designer shows an unhandled exception error has occurred:
>>>
>>>Unable to cast object of type 'MS.Internal.NamedObject' to type 'System.String'.
>>> at System.Linq.Enumerable.< CastIterator >d__b1`1.MoveNext()
>>> at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
>>> at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
>>> at SamaanSystems.IBC.WPF.OutstandingBalanceConverter.Convert(Object[] values, Type targetType, Object parameter, CultureInfo culture) in D:\Development\VS2010\IBC\IBC WPF\Converters\OutstandingBalanceConverter.cs:line 13
>>> at System.Windows.Data.MultiBindingExpression.TransferValue()
>>> at System.Windows.Data.MultiBindingExpression.Transfer()
>>> at System.Windows.Data.MultiBindingExpression.UpdateTarget(Boolean includeInnerBindings)
>>> at System.Windows.Data.MultiBindingExpression.AttachToContext(Boolean lastChance)
>>> at System.Windows.Data.MultiBindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean lastChance)
>>> at MS.Internal.Data.DataBindEngine.Task.Run(Boolean lastChance)
>>> at MS.Internal.Data.DataBindEngine.Run(Object arg)
>>> at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
>>> at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
>>>
>>>Any idea what I'm doing wrong?
Everything makes sense in someone's mind
public class SystemCrasher :ICrashable
In addition, an integer field is not for irrational people
Previous
Reply
Map
View

Click here to load this message in the networking platform