public static ComboListControl CreateComboListControl(ListLogicalView view) { var titleProperty = view.Meta.TitleProperty; if (titleProperty == null) { throw new InvalidProgramException(view.EntityType.Name + "类没有设置 Title 属性。"); } var ddl = new ComboListControl { InnerListView = view, Name = "下拉列表", VerticalAlignment = VerticalAlignment.Center, MinWidth = 150, }; ddl.DataContext = view; ddl.SetBinding(ComboListControl.TextProperty, "CurrentObject." + titleProperty); //当 View 发生 Refreshed 事件时,很可能表示有底层数据改变了,但是没有级联通知到界面上, //所以当 View 的控件被 Refresh 后,这个下拉框也需要主动进行刷新。 view.Refreshed += (o, e) => { ddl.GetBindingExpression(ComboListControl.TextProperty).UpdateTarget(); }; return(ddl); }
public ComboListControlAutomationPeer(ComboListControl owner) : base(owner) { }