在棱镜中,每个View都是一个UserControl,而我有一个View,包括这样的dependency property (在MyView.xaml.cs中):
public int WidgetCornerRadius
{
get { return (int)GetValue(WidgetCornerRadiusProperty); }
set { SetValue(WidgetCornerRadiusProperty, value); }
}
public static readonly DependencyProperty CornerRadiusProperty =
DependencyProperty.Register(
"CornerRadius",
typeof(int),
typeof(MyView),
new UIPropertyMetadata(7));我在下面的MyView.xaml (在Shell.xaml中)中显示了这个Region:
<ContentControl prism:RegionManager.RegionName="TargetRegion"/>现在我的问题是如何从内部填充视图的CornerRadius dependency property?我需要注册一个新的RegionAdapter吗?你能告诉我怎么做吗?
我想要这样的东西:
<ContentControl prism:RegionManager.RegionName="TargetRegion"
CornerRadius="3" />发布于 2015-08-13 08:20:04
与其将这个CornerRadius传递给您的视图,您不能仅仅从视图中寻找相对的源来查找该属性吗?这样应该容易多了。假设你有一个依赖于它的边界,你所要做的就是这样
<Border CornerRadius="{Binding RelativeSource={RelativeSource AncestorType={x:Type HereComesyourType}}, Path=CornerRadius}"/>https://stackoverflow.com/questions/31977877
复制相似问题