can you tell me what is the proper way to create custom silverlight controls? I want to make a control that consists of three other controls: textblock, autocompletebox and image. The textblock will act as a label for the autocompletebox and the image will provide additional tooltip. My question is: what type of class should I inherite from? How can I expose properties and events of the inner controls? I found that I can set values of child controls by creating additional dependency properties in the container class and using callback function like this:
public static readonly DependencyProperty TextProperty = DependencyProperty.Register(
"Text",
typeof(string),
typeof(MyCustomControl),
new PropertyMetadata(
default(string),
(source, args) => (source as MyCustomControl).TxtValue.Text = (string)args.NewValue
)
);
However this method works only if the property in the child control is declared as dependency property. But for instance in autocompletebox there is a property called ValueMemberBinding which is not a dependency property and I can't find a way how to expose this from MyCustomControl.