• 26.04.2024, 04:19
  • Registrieren
  • Anmelden
  • Sie sind nicht angemeldet.

 

about aquaero 2017-3.2 Date and Time

Dienstag, 2. Januar 2018, 09:40

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

Dienstag, 2. Januar 2018, 09:41

Dienstag, 2. Januar 2018, 14:15

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

Quellcode

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

Quellcode

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}'}"

Mittwoch, 3. Januar 2018, 23:55

thx.