当前位置:网站首页>BindingExpression path error: ‘selectMenusList‘ property not found on ‘object‘ ‘‘ViewModel“
BindingExpression path error: ‘selectMenusList‘ property not found on ‘object‘ ‘‘ViewModel“
2022-07-30 02:58:00 【太阳风暴】
BindingExpression path error: 'selectMenusList' property not found on 'object' ''ViewModel"
一、问题描述
1. 情况概述
在 使用WPF的 MVVM框架时,前端代码绑定 viewmodel代码里面出现
- BindingExpression path error: “属性字段” property not found on ‘object’ ‘’ viewmodel"
二、问题代码分析
- 前端代码
<ListBox Grid.Row="3" ItemsSource="{Binding SelectMenusList}" SelectedItem="{Binding SelcetMenu}"/>
- 后端代码
public List<string> SelectMenusList
public string SelcetMenu
三、解决办法
1. 原因分析
绑定的对象属性必须设置为依赖属性,也即是要 对属性 提供 get set 方法
2. 解决方法概述
把后端代码修改为如下
public List<string> SelectMenusList{
get; set;}
public string SelcetMenu{
get; set;}
边栏推荐
- 五种绑定彻底弄懂this,默认绑定、隐式绑定、显式绑定、new绑定、箭头函数绑定详解
- NLP自然语言处理(一)
- 中级-面试题目整理
- 详解轮播图二-通过left定位来轮播图片
- Excuse me, when datax is synchronized to the oceanbase database, it is written according to the primary key update method. How to fill in the content in the drop-down box?
- 联邦学习综述(二)——联邦学习的分类、框架及未来研究方向
- Leetcode.234 判断回文链表(双指针/快慢指针)
- B. Different Divisors- Codeforces Round #696 (Div. 2)
- VMware磁盘扩容记录
- 【ModelArts系列】华为ModelArts训练yolov3模型(训练管理)
猜你喜欢
随机推荐
First acquaintance with the web
【机器学习】通俗易懂决策树(原理篇)
乖宝宠物IPO过会:年营收25.75亿 KKR与君联是股东
Hacker News Broadcast | A fake offer steals $625 million
NLP自然语言处理(一)
【JS】iframe 嵌入页面用法
Simple Operations on Sequence
Excuse me, when datax is synchronized to the oceanbase database, it is written according to the primary key update method. How to fill in the content in the drop-down box?
中级-面试题目整理
开放地址法哈希实现——二次探测法
JUC (7): Thread Safety Analysis of Variables
Redis (ten) - Redission principle and practice
leetcode每天5题-Day01
【科研工具的使用】A
The box office broke 790 million US dollars. Have you watched this recent dinosaur movie?
使用SqlSessionFactory工具类抽取
gnss rtcm rtklib Ntrip...
复合类型--引用,指针
golang的channel实现原理
Are you still using the command line to read logs?Quickly use Kibana, visual log analysis YYDS









