代码之家  ›  专栏  ›  技术社区  ›  Kubi

控件中日期时间的绑定日期

  •  1
  • Kubi  · 技术社区  · 14 年前
    Text="{Binding Path=PostDate.Date}"
    

    我不想在我的控制下显示时间部分。 我要的不是8/26/2010上午12:00,而是8/26/2010。

    在没有任何显式/隐式转换或重写某些方法的情况下,是否有任何简单的方法可以做到这一点?

    1 回复  |  直到 14 年前
        1
  •  2
  •   Bubblewrap    14 年前

    从3.5 SP1开始,您可以使用binding.stringformat。见 this post 更多示例

    Text="{Binding Path=PostData.Data, StringFormat={}{0:MM/dd/yyyy}}"