0
우리는 두 가지 종속성 속성 인 Round 및 Depth가있는 사용자 지정 컨트롤이 있습니다.Datatemplate의 종속성 속성이 업데이트되지 않음
<DataTemplate x:Key="SyntDom" DataType="{x:Type entities:SwapInstrument}" >
...
<depthOfMarket:DOMControl Grid.Row="1" Instrument="{Binding}" Margin="10,5" Round="False" Depth="38">
...
</DataTemplate>
....
<ContentControl ContentTemplate="{StaticResource SyntDom}" Content="{Binding Instruments.Instrument1}"/>
다음 라운드 속성을 False 값으로 업데이트되지 않습니다 깊이 내가 ContentControl을 함께 포장하지 않고 직접 DOMControl를 사용하는 경우 그것의 38 괜찮 작동 느끼는 동안, : 나는 DataTemplate을에서 해당 컨트롤을 사용할 때 문제입니다.
컨트롤에서 이러한 속성에 대한 코드는 꽤 많이 복사 붙여 넣기이므로 문제가있는 것 같습니다.
UPD : 종속성 속성이
그래서 난 내 라운드 속성public static readonly DependencyProperty RoundProperty =
DependencyProperty.Register("Round", typeof (bool), typeof (DOMControl),
new PropertyMetadata(OnChangedRound));
로 정의했다
public static readonly DependencyProperty DepthProperty = DependencyProperty.Register("Depth", typeof (int), typeof (DOMControl), new PropertyMetadata(OnChangedDepth));
public int Depth
{
get { return (int) GetValue(DepthProperty); }
set { SetValue(DepthProperty, value); }
}
private static void OnChangedDepth(DependencyObject obj, DependencyPropertyChangedEventArgs args)
{
((DOMControl) obj).OnChangedDepth();
}
private void OnChangedDepth()
{
_dom.Depth = Depth;
BindGrid();
}
public static readonly DependencyProperty RoundProperty = DependencyProperty.Register("Round", typeof (bool), typeof (DOMControl), new PropertyMetadata(OnChangedRound));
public bool Round
{
get { return (bool) GetValue(RoundProperty); }
set { SetValue(RoundProperty, value); }
}
private static void OnChangedRound(DependencyObject obj, DependencyPropertyChangedEventArgs args)
{
((DOMControl) obj).OnChangedRound();
}
private void OnChangedRound()
{
_converterVolume.Round = Round;
}
'거짓 값으로 업데이트되었습니다'는게 무슨 뜻입니까? 업데이트가 'True'라는 뜻입니까? –
내가 디버깅 할 때 컨트롤의 Round 속성이 true로 설정되어 있다는 것을 알 수 있습니다. (컨트롤이 폼에서 처음 생성되었을 때 같음), xaml에 넣은 False 값을 가져 오지 않습니다. – athabaska
DP의 신고서를 보내주십시오. – nkoniishvt