Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Custom Control with two images

$
0
0

Hello!

I need to create a custom control which would represent a tooth. The control consists of 2 parts: crown and root. I need to put 2 Image controls together and make a distance between their centres as a parameter.

I'm quite new to WPF and do not totally realise the xaml-c# linking.

I've found an example on msdn, which shows how to create an ImageButton

public class ImageButton : Button
{
  public ImageSource Source
  {
    get { return base.GetValue(SourceProperty) as ImageSource; }
    set { base.SetValue(SourceProperty, value); }
  }
  public static readonly DependencyProperty SourceProperty =
    DependencyProperty.Register("Source", typeof(ImageSource), typeof(ImageButton));
}

When I try to set the image value as this

<custom:ImageButton Source="Image/main.png"/>

actually nothing changes at all.

Help me please to solve my control problem.

Looking forwad to your answers!


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>