вызывается
public sealed partial class TagsControl : UserControl
{
public static readonly DependencyProperty TagsProperty =
DependencyProperty.Register("Tags", typeof(ObservableCollection<ITag>), typeof(TagsControl),
new FrameworkPropertyMetadata() { BindsTwoWayByDefault = true, DefaultValue = new ObservableCollection<ITag>() });
private ObservableCollection<ITag> _tags;
public ObservableCollection<ITag> Tags
{
get => _tags;
set { _tags = value; }
}
}
<Window>
<Grid>
<tags:TagsControl Tags="{Binding Tags, Mode=TwoWay}"/>
</Grid>
</Window>
public partial class MainWindow : Window
{
public ObservableCollection<ITag> Tags { get; set; } = new ObservableCollection<ITag>();
public MainWindow()
{
InitializeComponent();
DataContext = this;
}
}
Обсуждают сегодня