2009-02-09 40 views
3

您好,即時通訊使用C#3.5,這可能嗎?在Listview(WPF)上綁定日期時間類型

<EditItemTemplate> 
             <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("date", "{dd/MM/YYYY}") %>'></asp:TextBox></EditItemTemplate> 
            <ItemTemplate> 

我嘗試:

<ListView Margin="0,80,0,38" Name="dlstInformes" Grid.ColumnSpan="2" > 
      <ListView.View> 
       <GridView> 
        <GridViewColumn Header="Numero Informe" DisplayMemberBinding="{Binding Path= numeroinforme}" > 
         <GridViewColumn.CellTemplate> 
          <DataTemplate> 
           <TextBlock > 

           </TextBlock> 
          </DataTemplate> 
         </GridViewColumn.CellTemplate> 
        </GridViewColumn> 
        <GridViewColumn Header="Nombre" DisplayMemberBinding="{Binding Path= nombreinforme}" /> 
        <GridViewColumn Header="Fecha Informe" DisplayMemberBinding="{Binding Path= fechainforme}" /> 
       </GridView> 
      </ListView.View> 

回答

6

一個解決方案在這裏:

<ListView Margin="0,80,0,38" Name="dlstInformes" MouseDoubleClick="dlstInformes_MouseDoubleClick"> 
     <ListView.View> 
      <GridView> 
       <GridViewColumn Header="Numero Informe" DisplayMemberBinding="{Binding Path= numeroinforme}" > 

       </GridViewColumn> 
       <GridViewColumn Header="Nombre" DisplayMemberBinding="{Binding Path= nombreinforme}" /> 
       <GridViewColumn Header="Fecha Informe"> 
        <GridViewColumn.CellTemplate> 
         <DataTemplate> 
          <TextBlock> 
          <TextBlock.Text> 
          <Binding Path="fechainforme" StringFormat="{}{0:MM/dd/yyyy}"/> 
          </TextBlock.Text> 
          </TextBlock> 
         </DataTemplate> 
        </GridViewColumn.CellTemplate> 
       </GridViewColumn> 

      </GridView> 
     </ListView.View> 

    </ListView> 

希望幫助...