我正在开发UWP应用程序,并且我创建了新的用户控件,并且想要将它绑定到控件的代码中的依赖项属性(不带datacontext)。将UWP控件绑定到属性后面的代码
代码背后:
public Brush Fill
{
get { return (Brush)GetValue(FillProperty); }
set { SetValue(FillProperty, value); }
}
// Using a DependencyProperty as the backing store for Fill. This enables animation, styling, binding, etc...
public static readonly DependencyProperty FillProperty =
DependencyProperty.Register("Fill", typeof(Brush), typeof(MyControl), new PropertyMetadata(new SolidColorBrush(Colors.Black)));
XAML:
...
<Grid>
<Path Fill="{Binding ????}" Stretch="Fill">
...
</Path>
</Grid>
我想我的路径的填充属性将代码绑定到该属性Fill
背后(数据上下文应持有不同的数据,所以我可以这里不使用它)
我如何在UWP中做到这一点?