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
c#
|silverlight-4.0
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