Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 키보드추천
- build.gradle
- QFIleSystemModel
- ViewModel
- painEvent
- QtHeader
- 문서작성용
- Q_UNUSED
- QPainter
- ModelClass
- QtDatabase
- apk빌드
- 모델클래스
- 오류해결
- QStringListModel
- widget
- QSqlQueryModel
- 펜타그래프
- QtDB
- QPixmap
- Android
- WigetHeader
- KeepAspectRatio
- QStandardItemModel
- 라이프썸
- Android Studio
- 예쁜키보드
- QT
- qt예제
- apk빌드오류
Archives
- Today
- Total
삐약디해의 성장일기
WPF Button에 Command Binding Error code 40 이슈 본문
<DataTemplate> 안에서
Command를 Binding 하는 부분에서 계속 이런 이슈가 생겼는데
The problem that I have is getting my button to work with the binding. I'm not sure what to set the DataContext. I am getting this error with my binding:
System.Windows.Data Error: 40 : BindingExpression path error: 'ClickMeCommand' property not found on 'object' ''Person' (HashCode=13029119)'. BindingExpression:Path=ClickMeCommand; DataItem='Person' (HashCode=13029119); target element is 'Button' (Name=''); target property is 'Command' (type 'ICommand')
왜 안되는지 거의 하루? 반나절을 끙끙거리다가
스택오버플로우 형님께서 DataTemplate안에서 Command 를 Binding 할 때 접근이 안된다고
RelativeSource를 써서 해야한다고 알려주셨다.........
앞으로 사용할 때 주의하자 !!
<DataTemplate>
<Border Background="{Binding Path=Color}" BorderThickness="1" BorderBrush="Black" Margin="10,2,0,2" ToolTip="{Binding Path=SeriesID}">
<StackPanel Orientation="Horizontal">
<Button x:Name="btn_deleteItem" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=DataContext.btnClickCommand }" Padding="2"
>
<ContentControl >
<Image Source="minus-condition.png" />
</ContentControl>
</Button>
<CheckBox IsChecked="{Bindin