Hi
I am working on a custom checkbox control which can take Content as plain text/image/both. I understand this can be easily acheived using XAML but what i need is a property ContentImage which when set will display both Image & Content. I inherited this control from checkbox and trying to do this custom implementation but nothing shows up.
public ImageSource ContentImage
{
get
{
return contentImage;
}
set
{
contentImage=value;
}
}
private void SetContentTemplate()
{
DataTemplate contentTemplate = new DataTemplate();
StackPanel sp = new StackPanel();
Image contentImage = new Image();
contentImage.Source = ContentImage;
sp.Children.Add(contentImage);
TextBlock contentText = new TextBlock();
contentText.SetBinding(TextBlock.TextProperty, Content.ToString());
sp.Children.Add(contentText);
contentTemplate.Resources.Add(sp, null);
this.ContentTemplate = contentTemplate;
}