WPF,C#. Xaml转换c#后台代码
<ContentControlSelector.IsSelected="True"Name="cc"Width="186"Height="170"Canvas.Top="...
<ContentControl Selector.IsSelected="True" Name="cc" Width="186" Height="170" Canvas.Top="211" Canvas.Left="47" Visibility="Visible" Style="{StaticResource DesignerItemStyle}" Focusable="False"> <Image Source="1.jpg" IsHitTestVisible="False" Height="97" Width="153" Stretch="Fill" ImageFailed="Image_ImageFailed" />
</ContentControl>
上述代码 如何改成c#后台代码。
ContentControl cc = new ContentControl();
cc.Style=Resources["DesignerItemStyle"] as Style ;
试了好多,只有上面这两行好像对。 展开
</ContentControl>
上述代码 如何改成c#后台代码。
ContentControl cc = new ContentControl();
cc.Style=Resources["DesignerItemStyle"] as Style ;
试了好多,只有上面这两行好像对。 展开
展开全部
So Easy!
ContentControl cc = new ContentControl ();
cc.Style = Resources["DesignerItemStyle"] as Style ;
cc.Name = "cc";
cc.Width = 186;
cc.Height = 170;
cc.Visibility = Visibility.Visible;
cc.Focusable = false;
Selector.SetIsSelected(cc,true);
Canvas.SetTop(cc,211);
Canvas.SetLeft(cc,47);
Image img = new Image();
Uri uri= new Uri("1.jpg");
img.Source = new BitmapImage(uri);
img.Width = ...
...
cc.Content = img;
ContentControl cc = new ContentControl ();
cc.Style = Resources["DesignerItemStyle"] as Style ;
cc.Name = "cc";
cc.Width = 186;
cc.Height = 170;
cc.Visibility = Visibility.Visible;
cc.Focusable = false;
Selector.SetIsSelected(cc,true);
Canvas.SetTop(cc,211);
Canvas.SetLeft(cc,47);
Image img = new Image();
Uri uri= new Uri("1.jpg");
img.Source = new BitmapImage(uri);
img.Width = ...
...
cc.Content = img;
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询