请帮助我在c#中使用setter。
事情是这样的:如何在通用Windows应用程序c中以编程方式使用setter#
Setter set = new Setter();
set.Target = image.Width;
请帮助我在c#中使用setter。
事情是这样的:如何在通用Windows应用程序c中以编程方式使用setter#
Setter set = new Setter();
set.Target = image.Width;
这是如何实现setter方法image.width
Setter setter1 = new Setter
{
Property = Image.WidthProperty,
Value = 123,
};
或/和
var setter2 = new Setter(Image.WidthProperty, 123);
编辑:我手写对不起
对不起。我应该更清楚。请参阅此[链接](https://msdn.microsoft.com/library/windows/apps/dn765018.aspx#step_5__adapt_the_ui_to_different_window_sizes)。我喜欢在c#中使用这些xaml代码。谢谢 – WithoutBrain1994
@ WithoutBrain1994哦,你的意思是从Setters的Setter? –
没错。我的意思是 – WithoutBrain1994
对于最佳实践安装人员应放置在xaml中。为您的自定义控件分配设置器值。 – 2015-11-08 16:41:44
我无法控制xaml视图,我可以指定setter。我在c#中添加了控件,而我也在c#中使用了setter。 – WithoutBrain1994
在C#代码中“以编程方式”创建控件在基于XAML的技术中被认为是不好的做法。无论你在做什么,删除所有的代码,并使用XAML和数据绑定以正确的方式进行。 –