Results 1 to 3 of 3

Thread: [RESOLVED] Object of type 'System.Windows.Data.Binding' cannot be converted to type

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2015
    Posts
    171

    Resolved [RESOLVED] Object of type 'System.Windows.Data.Binding' cannot be converted to type

    Hello,
    I've this usercontrol here: https://www.vbforums.com/showthread....ent&highlight=
    that have the property SelectedEndianess

    and in my app the the property:
    Code:
    Private Const m_Defaultendianess = 0
        Private _myendianess As String = m_Defaultendianess
        <DefaultValue(m_DefaultZoomV)>
        Public Property myEndianess() As String
            Get
                Return _myendianess
            End Get
            Set(ByVal value As String)
                SetAndNotify(_myendianess, value) 
            End Set
        End Property
    I'm trying to bind them so:
    Code:
     <local:myBitButton  x:Name="mybtnBitButton" Grid.Row="1" EndianessChanged="{s:Action mybtnBitButton_EndianessChanged}" SelectedEndianess="{Binding myEndianess , UpdateSourceTrigger=PropertyChanged}" ></local:myBitButton>
    but I'm getting this error: XDG0062 Object of type 'System.Windows.Data.Binding' cannot be converted to type 'System.String'.
    Any advice?

  2. #2
    PowerPoster Poppa Mintin's Avatar
    Join Date
    Mar 2009
    Location
    Bottesford, North Lincolnshire, England.
    Posts
    2,429

    Re: Object of type 'System.Windows.Data.Binding' cannot be converted to type

    Four days on and no answers to this one? That's unusual.
    Sadly I can't give a definitive answer, but usually when I'm confronted by "cannot be converted to type 'System.String'." I try to find somewhere to add ".ToString".


    Poppa
    Along with the sunshine there has to be a little rain sometime.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2015
    Posts
    171

    Re: Object of type 'System.Windows.Data.Binding' cannot be converted to type

    I solved: the problem was that in WPF to use databinding with usercontrol/custom control properties must implement dependency property.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width