nuget 패키지 설치
mainxaml 네임스페이스 추가
1
2
|
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions"
|
cs |
/window> 혹은 /Usercontrol> .... 바로 뒤에 추가
1
2
3
4
5
|
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<ei:CallMethodAction TargetObject="{Binding}" MethodName="LoadEvent" />
</i:EventTrigger>
</i:Interaction.Triggers>
|
cs |
viewModel 페이지에서 함수 생성
1
2
3
4
5
6
7
8
|
public class MainViewModel : INotifyPropertyChanged
{
public void LoadEvent()
{
//호출할 함수 ...든 뭐든
}
}
|
cs |
'WPF' 카테고리의 다른 글
[ wpf ] DataTemplate 속성 이름에 접근하는 방법 / 클릭 된 라디오 버튼 이름 가져오기 (0) | 2022.11.24 |
---|---|
[ wpf ] Property Grid 만드는 법 (0) | 2022.11.24 |
[ wpf ] Live Chart _ Doughnut Chart 사용해보기 (0) | 2021.11.26 |
[ wpf ] Remove ListView Header Separator Line 리스트뷰 헤더 분리선 없애기 (0) | 2021.07.09 |
[ wpf ] 바인딩 된 Datagrid Row Count 수를 Textbox에 불러오기 (0) | 2021.07.07 |