Problem on style a button

Posted by BTGMarco on Stack Overflow See other posts from Stack Overflow or by BTGMarco
Published on 2010-12-30T03:46:00Z Indexed on 2010/12/30 3:53 UTC
Read the original article Hit count: 169

Filed under:
|

Hello i am new on Silverlight, i tring to make a base for a button and that button will change the central image accoring to the situation, however some parts will continue the same, for this reason i make a UserControl and i call that user Control from the code and add to the grid that i need. But this Usercontrol that i am trying to add have a style pre-defined and i don´t geted how i change de image background. Here are the code that i am using;

ModelsBase teste = new ModelsBase();
Image img = new Image();
img.Source = new BitmapImage(new Uri("../../Images/person.png", UriKind.RelativeOrAbsolute));

img.Stretch = Stretch.Fill;img.ImageOpened += new EventHandler<RoutedEventArgs>(img_ImageOpened);
img.Height = img.Width = 128;
teste.Conteudo.HorizontalAlignment = HorizontalAlignment.Left;
this.ContentModels.Children.Add(teste);

The envent img_ImageOpened is called so the image is loaded, but not is displayed.

Sorry for bad english

If someone find out where is the problem, please aswer

© Stack Overflow or respective owner

Related posts about c#

Related posts about silverlight-4.0