• 03.03.2026, 17:38
  • S’inscrire
  • Connexion
  • Vous n’êtes pas connecté.

 

Bonjour, visiteur, bienvenue sur les forums Aqua Computer Forum. Si c’est votre première visite, nous vous invitons à consulter l’Aide. Elle vous expliquera le fonctionnement de cette page. Pour avoir accès à toutes les fonctionnalités, vous devez vous inscrire. Pour cela, veuillez utiliser le formulaire d’enregistrement, ou bien lisez plus d’informations sur la procédure d’enregistrement. Si vous êtes déjà enregistré, veuillez vous connecter.

huanghetv

Junior Member

about aquaero 2017-3.2 Date and Time

mardi 2 janvier 2018, 09:40

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

huanghetv

Junior Member

mardi 2 janvier 2018, 09:41

sebastian

Administrator

mardi 2 janvier 2018, 14:15

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

Code source

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

Code source

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

mercredi 3 janvier 2018, 23:55

thx.