Answer the question
In order to leave comments, you need to log in
How to pass a link to a parameter using xaml?
Actually, you need exactly what is in the question.
I can pass meaningful parameters, it's easy:
<ObjectDataProvider x:Key="userDCustom" ObjectType="{x:Type local:UserData}">
<ObjectDataProvider.ConstructorParameters>
<system:String>myName</system:String>
</ObjectDataProvider.ConstructorParameters>
</ObjectDataProvider>
public class UserData
{
public string Name { get; set; }
public UserData ( string name )
{
Name = name;
}
}
public class User
{
UserData _uData;
public UserData UserData
{
get { return _uData; }
private set { _uData = value; }
}
public User ( UserData data )
{
UserData = data;
}
}
Answer the question
In order to leave comments, you need to log in
It may be worth abandoning constructors with parameters and setting parameters as properties.
More or less like this:
<ObjectDataProvider x:Key="userDCustom" ObjectType="{x:Type local:UserData}">
<ObjectDataProvider.ConstructorParameters>
<local:User>
<local:User.UserData>
<local.User Name="MyName" />
</local:User.UserData>
</local:User>
</ObjectDataProvider.ConstructorParameters>
</ObjectDataProvider>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question