I used the code below with your Model code and it should work fine. If there are any questions please let me know.
Xaml:
<Window.DataContext>
<local:MachineViewModel/>
</Window.DataContext>
<StackPanel Orientation="Horizontal" Margin="250,0,0,0">
<Label Content="Date" Width="45" Height="30"/>
<TextBox x:Name="txtboxdate" Width="100" Height="20" IsReadOnly="True" Background="#bc9d1b" Text="{Binding Path=Mch.MchCurrentTime, StringFormat=MM/dd/yyyy, Mode=OneWay}"/>
<Label Content="Time" Width="45" Height="30" Margin="40,0,0,0"/>
<TextBox x:Name="txtboxtime" Width="100" Height="20" IsReadOnly="True" Background="#bc9d1b" Text="{Binding Path=Mch.MchCurrentTime, StringFormat=hh:mm:ss.fff tt, Mode=OneWay}"/>
</StackPanel>
ViewModel:
public class MachineViewModel
{
public MachineViewModel()
{
_mch = new Machine();
}
private Machine _mch;
public Machine Mch
{
get
{
return _mch;
}
set
{
_mch = value;
}
}
}
The result:
----------------------------------------------------------------------------
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.