• 05.05.2026, 11:34
  • Register
  • Login
  • You are not logged in.

 

Dear visitor, welcome to Aqua Computer Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

huanghetv

Junior Member

about aquaero 2017-3.2 Date and Time

Tuesday, January 2nd 2018, 9:40am

hello,
Can I add current date&Time to the page(overview page)?

huanghetv

Junior Member

Tuesday, January 2nd 2018, 9:41am

sebastian

Administrator

Tuesday, January 2nd 2018, 2:15pm

Hi,
you have to add a user defined object with this code:

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<UserControl
    x:Name="this"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300">
    <Grid>
        <TextBlock
            Text="{Binding Source={x:Static sys:DateTime.Now},StringFormat='{}{0:dd-MMM-yyyy hh:mm:ss}'}"        
            Opacity="1.0"
            Height="Auto" 
            Width="Auto"
            Foreground="#FF000000"
            FontSize="15"
            FontFamily="Segoe UI"
            FontWeight="Normal"                    
            Margin="0,0,0,0" 
            Padding="0,0,0,0"
            HorizontalAlignment="Center" 
            VerticalAlignment="Center"/>
    </Grid>
</UserControl>



here you can find the string format specificer
https://docs.microsoft.com/en-us/dotnet/…-format-strings


important are this lines

Source code

1
2
3
4
xmlns:sys="clr-namespace:System;assembly=mscorlib"

and
Text="{Binding Source={x:Static sys:DateTime.Now},StringFormat='{}{0:dd-MMM-yyyy hh:mm:ss}'}"

huanghetv

Junior Member

Wednesday, January 3rd 2018, 11:55pm

thx.