【发布时间】:2017-08-04 13:40:58
【问题描述】:
我需要使用动态创建的LinearGradientBrush 创建组件。
我尝试过的:
查看:
<Grid.Background>
<LinearGradientBrush EndPoint="0.5,1"
MappingMode="RelativeToBoundingBox"
StartPoint="0.5,0"
GradientStops="{Binding ColorsThresholds }">
</LinearGradientBrush>
</Grid.Background>
视图模型:
public class MyViewModel: Screen
{
public BindableCollection<GradientStop> ColorsThresholds
{
get
{
return = GenerateRanges();
}
}
private BindableCollection<GradientStop> GenerateRanges()
{
//Some generating stuff
}
public MyViewModel()
{
NotifyOfPropertyChange(()=> ColorsThresholds);
}
}
ColorsThresholds 生成良好,但仍不可见。
【问题讨论】:
标签: c# wpf mvvm caliburn.micro