먼저 Silverlight를 처음 사용한다고 말해 보겠습니다. 그러나 나는 "기본"Silverlight의 대부분을 알아 냈습니다. 나는 지금 Silverlight 3를 사용하고 있습니다.Silverlight 3 IValueConverter 문제
간단히 말해서, 내 IValueConverter가 UserControl 내부에서 호출되는 것을보고 있지 않습니다. 그러나 많은 것들과 마찬가지로, 그렇게 간단하지 않습니다. UserControl은 DataGrid 셀의 DataColumnTemplate이 런타임에 XAML에 의해 생성되는 열에 있습니다. 그래서 셀의 내용이 내 UserControl을에
StringBuilder CellTemp = new StringBuilder();
CellTemp.Append("<DataTemplate ");
CellTemp.Append("xmlns:aa='clr-namespace:InvTech.AA.Silverlight.UI;assembly=AASilverlight' ");
CellTemp.Append("xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' ");
CellTemp.Append("xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' ");
CellTemp.Append(">");
CellTemp.AppendFormat("<aa:ProductAssetView DataContext='{{Binding Products[{0}]}}' />", index);
CellTemp.Append("</DataTemplate>");
return CellTemp.ToString();
을 결합지고 :
다음은 열 내 DataTemplate을합니다. 이 작품; 난 그냥 내 IValueConverter 내가 원하는 방식으로 UserControl의 내용을 서식을 호출 할 수 없습니다.
UserControl을 XAML의 신체 :
(접두사를 선언)
xmlns:aaConv="clr-namespace:InvTech.AA.Silverlight.Core;assembly=AA.Core"
(그리드 레이아웃 내부 바인딩 된 컨트롤)
<TextBox x:Name="txtSAA" Grid.Row="0" Grid.Column="0" Text="{Binding SAA, Converter={StaticResource PercentConverter}, Mode=TwoWay}" Width="35" FontSize="9"/>
<TextBox x:Name="txtOVR" Grid.Row="0" Grid.Column="1" Text="{Binding Overlay, Converter={StaticResource PercentConverter}, Mode=TwoWay}" Width="35" FontSize="9" />
<TextBox x:Name="txtTAA" Grid.Row="0" Grid.Column="2" Text="{Binding TAA, Converter={StaticResource PercentConverter}, Mode=TwoWay}" Width="35" FontSize="9" />
<TextBlock x:Name="tbkCurrent" Grid.Row="0" Grid.Column="3" Text="TODO" Width="35" FontSize="9" />
<Grid.Resources>
<aaConv:PercentValueConverter x:Key="PercentConverter" />
</Grid.Resources>
뭔가 여기에 분명히 잘못이 있습니까? 동적 XAML이 중요한 요소입니까? 나는이 동적 XAML 템플릿에 비해 사소한해야처럼 ... 기분이 마지막이 알아 낸
감사