Click here to Skip to main content
15,508,473 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: WPF Multiple Projects Resource Dictionary Pin
Jammer10-Jan-09 6:54
Jammer10-Jan-09 6:54 
GeneralRe: WPF Multiple Projects Resource Dictionary Pin
Bex_300012-Jan-09 1:12
Bex_300012-Jan-09 1:12 
GeneralRe: WPF Multiple Projects Resource Dictionary Pin
Jammer12-Jan-09 23:42
Jammer12-Jan-09 23:42 
GeneralRe: WPF Multiple Projects Resource Dictionary Pin
Bex_300013-Jan-09 0:47
Bex_300013-Jan-09 0:47 
GeneralRe: WPF Multiple Projects Resource Dictionary Pin
Jammer13-Jan-09 11:12
Jammer13-Jan-09 11:12 
QuestionMove a 3D object on screen. Pin
ParagGupta9-Jan-09 3:07
ParagGupta9-Jan-09 3:07 
QuestionTo format date in datagrid column in silverlight Pin
priyagee9-Jan-09 2:02
priyagee9-Jan-09 2:02 
AnswerRe: To format date in datagrid column in silverlight Pin
johnsontroye9-Jan-09 18:22
johnsontroye9-Jan-09 18:22 
If you are binding to collection of custom objects such as Person and that class has a property such as BirthDate you could do the following:

First, create DateTimeConverter class as such:

Imports System.Windows.Data

Public Class DateTimeConverter
Implements IValueConverter

Public Function Convert(ByVal value As Object, _
ByVal targetType As System.Type, _
ByVal parameter As Object, _
ByVal culture As System.Globalization.CultureInfo) As Object _
Implements System.Windows.Data.IValueConverter.Convert

Dim DateValue As DateTime = value
Return DateValue.ToShortDateString()

End Function


Public Function ConvertBack(ByVal value As Object, _
ByVal targetType As System.Type, _
ByVal parameter As Object, _
ByVal culture As System.Globalization.CultureInfo) As Object _
Implements System.Windows.Data.IValueConverter.ConvertBack

Dim StrValue As String = value.ToString()
Dim ResultDateTime As DateTime

If DateTime.TryParse(StrValue, ResultDateTime) Then
Return ResultDateTime
End If

Return value

End Function

End Class


Next, add xmlns to to your projects namespace so you can get reference to your new class such as:
xmlns:local="clr-namespace:Silverlight_DataGrid"


Next, depending on what type of control you are using to bind to, add reference to your converter for date column. In this case, I have single column in grid, which is bound to DataGridTextColumn. The property in my class i'm binding to is BirthDate.

<data:DataGrid x:Name="myDataGrid" Grid.Row="1"
AlternatingRowBackground="AliceBlue"
Background="WhiteSmoke"
BorderBrush="DarkBlue" BorderThickness="2"
CanUserResizeColumns="True"
CanUserSortColumns="True"
Opacity="8"
AutoGenerateColumns="False">

<data:DataGrid.Columns>

<data:DataGridTextColumn Binding="{Binding BirthDate, Converter={StaticResource DateConverter}}" />

</data:DataGrid.Columns>


</data:DataGrid>


GeneralRe: To format date in datagrid column in silverlight Pin
priyagee11-Jan-09 21:11
priyagee11-Jan-09 21:11 
QuestionNeeded sample Program Which run on both windows and web. Pin
vinethgentle9-Jan-09 0:51
vinethgentle9-Jan-09 0:51 
AnswerRe: Needed sample Program Which run on both windows and web. Pin
Pete O'Hanlon9-Jan-09 2:20
mvaPete O'Hanlon9-Jan-09 2:20 
QuestionGridSplitter Cursor Pin
Johan Lombaard8-Jan-09 23:27
Johan Lombaard8-Jan-09 23:27 
AnswerRe: GridSplitter Cursor Pin
User 27100910-Jan-09 16:15
User 27100910-Jan-09 16:15 
QuestionRe: GridSplitter Cursor Pin
bootis13-Aug-10 0:21
bootis13-Aug-10 0:21 
AnswerRe: GridSplitter Cursor Pin
mocasu8-Sep-10 7:16
mocasu8-Sep-10 7:16 
AnswerRe: GridSplitter Cursor Pin
schiebel-t3-Feb-09 2:50
schiebel-t3-Feb-09 2:50 
GeneralRe: GridSplitter Cursor Pin
xsumo16-Mar-10 12:49
xsumo16-Mar-10 12:49 
QuestionUnknown Error Pin
Vimalsoft(Pty) Ltd8-Jan-09 19:56
professionalVimalsoft(Pty) Ltd8-Jan-09 19:56 
AnswerRe: Unknown Error Pin
Mohammad Dayyan19-Jan-09 18:49
Mohammad Dayyan19-Jan-09 18:49 
GeneralRe: Unknown Error Pin
Vimalsoft(Pty) Ltd19-Jan-09 23:38
professionalVimalsoft(Pty) Ltd19-Jan-09 23:38 
GeneralRe: Unknown Error Pin
Mohammad Dayyan20-Jan-09 10:27
Mohammad Dayyan20-Jan-09 10:27 
GeneralRe: Unknown Error Pin
Vimalsoft(Pty) Ltd20-Jan-09 20:26
professionalVimalsoft(Pty) Ltd20-Jan-09 20:26 
GeneralRe: Unknown Error Pin
Mohammad Dayyan20-Jan-09 20:44
Mohammad Dayyan20-Jan-09 20:44 
GeneralRe: Unknown Error Pin
Vimalsoft(Pty) Ltd20-Jan-09 20:48
professionalVimalsoft(Pty) Ltd20-Jan-09 20:48 
GeneralRe: Unknown Error Pin
Mohammad Dayyan20-Jan-09 20:55
Mohammad Dayyan20-Jan-09 20:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.