私の従業員のリストの各項目にはPostプロパティがあります。このプロパティはInt64タイプです。また、ObservableDictionary<Int64,String>静的プロパティとしていくつか持っています。各従業員はString、そのキーによって値を表示する必要があります。アイテムの DataTemplate Employe(余分なものを削除しました):
<DataTemplate x:Key="tmpEmploye">
<Border BorderThickness="3" BorderBrush="Gray" CornerRadius="5">
<StackPanel Orientation="Vertical">
<TextBlock Text="{Binding Path=Post}"/>
</StackPanel>
</Border>
</DataTemplate>
しかし、このコードはInt64ではなく値を表示しましたString。静的辞書を取得するための文字列:
"{Binding Source={x:Static app:Program.Data}, Path=Posts}"
の問題を解決する方法はComboBox知っていますが、 についてはわかりませんTextBlock。私はそれComboBoxを書いたので(それは正常に動作します):
<ComboBox x:Name="cboPost" x:FieldModifier="public" Grid.Row="4" Grid.Column="1" HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" Margin="2" Grid.ColumnSpan="2"
ItemsSource="{Binding Source={x:Static app:Program.Data}, Path=Posts}" DisplayMemberPath="Value"
SelectedValuePath="Key"
SelectedValue="{Binding Path=Post, Mode=TwoWay}">
</ComboBox>
しかし、どうすればそれを解決できTextBlockますか?