4
이 작동합니다.WPF - 스타일 설정자 속성 바인딩
<Setter Property="Width" Value="300" />
<Setter Property="Height" Value="300" />
하지만 변경하면 작동하지 않습니다.
<Setter Property="Width" Value="{Binding ImageSize, Mode=TwoWay}" />
<Setter Property="Height" Value="{Binding ImageSize, Mode=TwoWay}" />
및 선언
private Int32 imageSize;
public Int32 ImageSize
{
get { return imageSize; }
set
{
imageSize = value;
NotifyPropertyChanged("ImageSize");
}
}
잘못 무엇입니까?
스타일이 적용되는 항목에서 'DataContext'를 어디에 설정하고 있습니까? –
UserControl에서 DataContext = "{Binding ElementName = CodeBehind}" – mozkarakoc
그리고 나서 CodeBehind라는 UserControl이 있습니까? 가장 큰 원인은'DataContext'에서 ImageSize 속성을 찾지 못하고 있다는 것입니다. 출력 창에서 바인딩 오류가 있는지 확인하고 코드를 더 게시하여 문제를 해결하는 것이 더 쉽습니다. –