Click here to Skip to main content
15,884,933 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: UserControl Databinding Pin
mikla5213-May-09 10:25
mikla5213-May-09 10:25 
GeneralRe: UserControl Databinding Pin
mikla5213-May-09 21:04
mikla5213-May-09 21:04 
AnswerRe: UserControl Databinding Pin
Kunal Chowdhury «IN»13-May-09 20:42
professionalKunal Chowdhury «IN»13-May-09 20:42 
AnswerRe: UserControl Databinding Pin
Gideon Engelberth4-May-09 3:24
Gideon Engelberth4-May-09 3:24 
QuestionHow to read images in a single image file (.png format) Pin
seshu4code2-May-09 23:58
seshu4code2-May-09 23:58 
AnswerRe: How to read images in a single image file (.png format) Pin
Mark Salsbery3-May-09 8:47
Mark Salsbery3-May-09 8:47 
GeneralRe: How to read images in a single image file (.png format) Pin
seshu4code6-May-09 23:49
seshu4code6-May-09 23:49 
QuestionListView (with GridView) - Bound to Observable Collection [modified] Pin
b4ip2-May-09 19:56
b4ip2-May-09 19:56 
Overview
WPF Project (VS 2008)

I'm using a ListView (with GridView) bound to an ObservableCollection. The collection includes a DateTime field.
When I populate the collection, the DateNR field is often null, but then the ListView displays a date of "01-Jan-01"!!

How do I stop this as I don't want the user to see a date when there shouldn't be one. I need the DateNR field in the collection to be a DateTime value not a string because this column is used for sorting.

Any ideas would be welcome. thanks

<br />
        public class RecordData<br />
        {<br />
            public int ID { get; set; }<br />
            public DateTime DateNR { get; set; }<br />
        }<br />

The GridView column for 'DateNR' is specified as follows:
<br />
        GridViewColumnHeader gvch = new GridViewColumnHeader();<br />
        GridViewColumn gvc = new GridViewColumn();<br />
        Binding bind = new Binding("DateNR");<br />
        bind.Converter = new FormattingConverter();<br />
        bind.ConverterParameter = @"{0:dd-MMM-yy}";<br />
        gvc.Width = 80;<br />
        gvc.DisplayMemberBinding = bind;<br />
        gvch.Content = "NR Date";<br />
        gvc.Header = gvch;<br />
        myGridView.Columns.Add(gvc);<br />


<br />
        SqlConnection sqlConn = new SqlConnection(myConnectionString);<br />
        SqlCommand sqlComm = new SqlCommand("...", sqlConn);<br />
        SqlDataReader sqlDR = sqlComm.ExecuteReader();<br />
        // ...<br />
        RecordData rd = new RecordData();<br />
        rd.ID = sqlDR.GetInt32(0);<br />
        if (sqlDR.IsDBNull(1) == false)<br />
            rd.DateNR = sqlDR.GetDateTime(1);<br />
        // ...<br />
       _MyCollection.Add(rd);<br />


modified on Saturday, September 19, 2009 5:46 AM

QuestionWPF and XNA physic engines ! Pin
Mohammad Dayyan2-May-09 12:06
Mohammad Dayyan2-May-09 12:06 
RantVS2008's inability to update service references [modified] Pin
Ravi Bhavnani2-May-09 9:30
professionalRavi Bhavnani2-May-09 9:30 
GeneralRe: VS2008's inability to update service references Pin
Mark Salsbery4-May-09 9:59
Mark Salsbery4-May-09 9:59 
GeneralRe: VS2008's inability to update service references Pin
Ravi Bhavnani4-May-09 10:01
professionalRavi Bhavnani4-May-09 10:01 
GeneralRe: VS2008's inability to update service references Pin
Ravi Bhavnani4-May-09 18:17
professionalRavi Bhavnani4-May-09 18:17 
QuestionReading items into a TreeView from an ACCESS database Pin
Etienne_1232-May-09 3:35
Etienne_1232-May-09 3:35 
AnswerRe: Reading items into a TreeView from an ACCESS database Pin
Pete O'Hanlon2-May-09 9:57
mvePete O'Hanlon2-May-09 9:57 
QuestionUserControl question Pin
RugbyLeague1-May-09 4:54
RugbyLeague1-May-09 4:54 
AnswerRe: UserControl question Pin
AghaKhan1-May-09 5:32
AghaKhan1-May-09 5:32 
AnswerRe: UserControl question Pin
#realJSOP1-May-09 5:34
mve#realJSOP1-May-09 5:34 
GeneralRe: UserControl question Pin
RugbyLeague1-May-09 5:38
RugbyLeague1-May-09 5:38 
GeneralRe: UserControl question Pin
AghaKhan1-May-09 6:01
AghaKhan1-May-09 6:01 
AnswerRe: UserControl question Pin
Gideon Engelberth1-May-09 6:03
Gideon Engelberth1-May-09 6:03 
GeneralRe: UserControl question Pin
AghaKhan1-May-09 6:17
AghaKhan1-May-09 6:17 
GeneralRe: UserControl question Pin
Gideon Engelberth1-May-09 11:49
Gideon Engelberth1-May-09 11:49 
GeneralRe: UserControl question Pin
AghaKhan1-May-09 18:56
AghaKhan1-May-09 18:56 
GeneralRe: UserControl question Pin
RugbyLeague1-May-09 9:19
RugbyLeague1-May-09 9:19 

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.