0
J'essaye d'ajouter un ContentControl
par l'intermédiaire du code de fond dans C#, mais n'ai pas pu mettre l'image dans ContentControl
par le code.Ajouter une source d'image à ContentControl du code C# derrière
est ici le code de travail en XAML
<ContentControl x:Name="cControl" Width="200"
Height="200"
Canvas.Left="210"
Canvas.Top="220"
Style="{StaticResource DesignerItemStyle}">
<Image IsHitTestVisible="False" Stretch="Fill" Source="pack://application:,,,../Resources/ACImages/737.png"/>
</ContentControl>
en C# est ce jusqu'à ce que j'ai:
Image ACimage = new Image();
BitmapImage image = new BitmapImage();
image.BeginInit();
image.UriSource = new Uri("pack://application:,,,../Resources/ACImages/737.png");
image.EndInit();
ACimage.Source = image;
ContentControl myContentControl = new ContentControl();
Style s = this.FindResource("DesignerItemStyle") as Style;
myContentControl.Style = s;
Comment puis-je mettre le ACimage
dans le ContentControl
?