Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hello Friends :)
I'm New to c# and wpf,and i'm stuck in this , i googled but i cant find a answer .
please Help :)

my Qusetion,
I want to call a Method in GetLoc that takes 1 argument (Object of ComboLoad Class) from my xaml.

Combo Load Class
C#
namespace BE
{
    public class ComboLoad
    {
        public int MyProperty { get; set; }
    }
}


GetLoc Class
C#
namespace DS
{
    public class GetLoc
    {
        public GetLoc(ComboLoad obj)
        {

        }

        public void getCombodata(ComboLoad cmb)
        {
            new CmbLoad().getLocToCombo(cmb);


        }
    }
}


And My XAML
/*<window.resources>
<ObjectDataProvider x:Key="cmbObjectBE" ObjectType="{x:Type BE:ComboLoad}" />
<ObjectDataProvider ObjectType="{x:Type DS:GetLoc}"
MethodName="getCombodata" x:Key="cmbObjectDS">
<ObjectDataProvider.MethodParameters>
<be:comboload xmlns:be="#unknown">cmbObjectBE
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>


<grid datacontext="{Binding Source={StaticResource cmbObjectDS}}">*/

It says their is a error in this line
"<be:comboload xmlns:be="#unknown">cmbObjectBE"

Error -> The Type ComboLoad Does Not Support direct Content


Sorry For the Poor English
And Thank You ! :)
Posted
Updated 27-May-12 21:27pm
v2

- This error occurs when you try to use object element syntax with a type which does not have a content property specified by the ContentPropertyAttribute.
- This error is raised when the file is a well-formed XAML document, but contains one or more type mismatches.


Look here for details: MSDN: The type '{0}' does not support direct content[^]
 
Share this answer
 
v2
Yes, your ObjectDataProvider.MethodParameters can not have any text (cmbObjectBE) inside the declaration.

http://msdn.microsoft.com/en-us/library/system.windows.data.objectdataprovider.methodparameters.aspx[^]

You need to specify the parameter value like:
XML
<system:double xmlns:system="#unknown">0</system:double>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900