自定义依赖属性无法识别?
自定义了ItemsSource SelectedItems两个属性
用户控件定义
引用时提示ItemsSource SelectedItems无法识别或被访问,是什么情况?
public static readonly DependencyProperty ItemsSourceProperty =
DependencyProperty.Register("ItemsSource", typeof(ObservableCollection<MultiComboBoxModel>), typeof(MulitComboBoxUserControl),new UIPropertyMetadata(null));
public ObservableCollection<MultiComboBoxModel> ItemsSource
{
get { return (ObservableCollection<MultiComboBoxModel>)GetValue(ItemsSourceProperty); }
set
{
SetValue(ItemsSourceProperty, value);
}
}
public static readonly DependencyProperty SelectedItemsProperty = DependencyProperty.Register("SelectedItems", typeof(ObservableCollection<MultiComboBoxModel>), typeof(MulitComboBoxUserControl), new PropertyMetadata(null,null));
public ObservableCollection<MultiComboBoxModel> SelectedItems
{
get { return (ObservableCollection<MultiComboBoxModel>)GetValue(SelectedItemsProperty); }
set
{
SetValue(SelectedItemsProperty, value);
}
}
用户控件定义
<Grid>
<ComboBox Text="{Binding SelectedText}" IsEditable="True" ItemsSource="{Binding ItemsSource}" >
<ComboBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding IsChecked}" Click="CheckBox_Click"/>
<TextBlock Text="{Binding Title}"/>
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
引用时提示ItemsSource SelectedItems无法识别或被访问,是什么情况?
<control:MulitComboBoxUserControl Grid.Row="0" ItemsSource="{Binding ItemsSource}" SelectedItems="{Binding SelectedItems}"></control:MulitComboBoxUserControl>
...全文
相关推荐
java unzip linux 下面不识别中文问题 解决方案;
**创建自定义解压工具**: 如果以上方法都无法解决,还可以选择编写一个自定义的解压工具,该工具使用Java NIO和文件系统API,确保在整个解压过程中使用UTF-8编码处理文件名。
Python用sndhdr模块识别音频格式详解
如果文件格式无法被识别,则返回`None`。2.
android自定义Toast
- `.project`:Eclipse或Android Studio项目的配置文件,用于IDE识别项目类型和构建设置。- `.classpath`:记录项目依赖的库和其他类路径信息。
USB无法识别的设备
### USB无法识别的设备#### 问题描述与分析当用户遇到U盘插入电脑后,电脑提示“无法识别的设备”的情况时,这通常意味着U盘未能被操作系统正确识别或存在某些硬件问题。
C#中WPF依赖属性的正确学习方法
注册后,依赖属性可以在整个应用程序范围内被识别和使用。5.


