Quantcast
Channel: Extended WPF Toolkit™ Community Edition
Viewing all articles
Browse latest Browse all 4964

New Post: DateTime Column - Specific Format!?

$
0
0
Hi,

If you have the Toolkit Plus Edition(or want to buy it here : http://xceed.com/Extended_WPF_Toolkit_Intro.html ), you can use EditorDefinitions like this
<Grid>
      <xctk:PropertyGrid x:Name="_propertyGrid">
         <xctk:PropertyGrid.EditorDefinitions >
            <xctk:EditorDateTimeUpDownDefinition TargetProperties="{x:Type sys:DateTime}"
                                                 Format="MonthDay" />
         </xctk:PropertyGrid.EditorDefinitions>
      </xctk:PropertyGrid>
   </Grid>
It will let you format all properties with type DateTime in a specific format and this editor will be formatted in a PropertyGrid way.

Another option can be to declare a DataTemplate for properties of type DateTime :
<Grid>
      <xctk:PropertyGrid x:Name="_propertyGrid">
         <xctk:PropertyGrid.EditorDefinitions >
            <xctk:EditorTemplateDefinition TargetProperties="{x:Type sys:DateTime}">
               <xctk:EditorTemplateDefinition.EditingTemplate>
                  <DataTemplate>
                     <xctk:DateTimeUpDown Value="{Binding Value}"
                                          Format="MonthDay"/>
                  </DataTemplate>
               </xctk:EditorTemplateDefinition.EditingTemplate>
            </xctk:EditorTemplateDefinition>
         </xctk:PropertyGrid.EditorDefinitions>
      </xctk:PropertyGrid>
   </Grid>

Viewing all articles
Browse latest Browse all 4964

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>