public class DateConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return System.Convert.ToDateTime(value, System.Globalization.CultureInfo.CurrentCulture).ToShortDateString(); } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return System.Convert.ToDateTime(value, System.Globalization.CultureInfo.CurrentCulture); } }
xmlns:local="clr-namespace:MySilverlightApplication"
<local:DateConverter x:Key="DateConverter" />
<esri:FeatureDataGrid x:Name="MyDataGrid" AutoGenerateColumns="False" Map="{Binding ElementName=MyMap}" GraphicsLayer="{Binding Layers[MyGraphicsLayer], ElementName=MyMap}"> <esri:FeatureDataGrid.Columns> <data:DataGridTextColumn Binding="{Binding STRING_ATTRIBUTE}" Header="String Attribute" /> <data:DataGridTextColumn Binding="{Binding DATE_ATTRIBUTE, Converter={StaticResource DateConverter}}" Header="Date Attribute" /> </esri:FeatureDataGrid.Columns> </esri:FeatureDataGrid>
xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
Unfortunately, graphics layers do not have any information in regards to this and you have to write your own converters for your attributes.
3. Get reference to the predefined graphics layer and add the result graphic object to it.4. Set GraphicsLayer and Map property of the FDG.
In addition, if you're adding features to a GraphicsLayer and using this layer as the source of your FeatureDataGrid then date fields format won't match the format in SDE because these layers do not have field/attribute information as opposed to feature layers.
サインインしたメンバーは投稿、更新のフォローなどができます。初めてですか?無料アカウントを登録してください。
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.