本文整理汇总了C#中DataTemplate.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# DataTemplate.SetValue方法的具体用法?C# DataTemplate.SetValue怎么用?C# DataTemplate.SetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataTemplate
的用法示例。
在下文中一共展示了DataTemplate.SetValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Text
public void Text()
{
var template = new DataTemplate (typeof (SwitchCell));
template.SetValue (SwitchCell.TextProperty, "text");
SwitchCell cell = (SwitchCell)template.CreateContent();
Assert.That (cell.Text, Is.EqualTo ("text"));
}
示例2: On
public void On()
{
var template = new DataTemplate (typeof (SwitchCell));
template.SetValue (SwitchCell.OnProperty, true);
SwitchCell cell = (SwitchCell)template.CreateContent();
Assert.That (cell.On, Is.EqualTo (true));
}
示例3: SetBindingOverridesValue
public void SetBindingOverridesValue()
{
var template = new DataTemplate (typeof (MockBindable));
template.SetValue (MockBindable.TextProperty, "value");
template.SetBinding (MockBindable.TextProperty, new Binding ("."));
MockBindable bindable = (MockBindable) template.CreateContent();
Assume.That (bindable.GetValue (MockBindable.TextProperty), Is.EqualTo (bindable.BindingContext));
bindable.BindingContext = "binding";
Assert.That (bindable.GetValue (MockBindable.TextProperty), Is.EqualTo ("binding"));
}
示例4: SetValueInvalid
public void SetValueInvalid()
{
var template = new DataTemplate (typeof (MockBindable));
Assert.That (() => template.SetValue (null, "string"), Throws.InstanceOf<ArgumentNullException>());
}
示例5: Detail
public void Detail ()
{
var template = new DataTemplate (typeof (TextCell));
template.SetValue (TextCell.DetailProperty, "detail");
TextCell cell = (TextCell)template.CreateContent ();
Assert.That (cell.Detail, Is.EqualTo ("detail"));
}