Change DatePickerTextBox value

176 Views Asked by At

Hello I changed the value of the DatePicketTextBox :

<DatePicker Grid.Column="3"
            Grid.Row="1"
            SelectedDate="{Binding Order.DateIn, Mode=TwoWay}"
            Width="200"
            Height="30"
            HorizontalAlignment="Left"
            VerticalContentAlignment="Center"
            Margin="10 0 0 20">
    <DatePicker.Resources>
        <Style TargetType="DatePickerTextBox">
            <Setter Property="Text" Value="Selecteer een datum" />
        </Style>
    </DatePicker.Resources>
</DatePicker>

When I start the application and click on "New Order" it shows this (the correct values) :

enter image description here

If I then click on another product where for example the "Besteldatum" is set :

enter image description here

And then click on the button "New Order" it shows the English default value again for the field "Besteldatum". And it seems that it shows again the default value when the value was set. Hope it is clear, any ideas?

enter image description here

EDIT :

Here is a better overview, the list with orders based on year and at the far righ the "Nieuwe bestelling" ("New Order") button :

enter image description here

Here is the code to show the "Nieuwe betselling" UserControl :

private void OrderUserControl(Order order)
{
    ShowOrderUserControl = Visibility.Visible;

    Products = _productService.GetProducts();

    if (order == null)
    {
        Order = new Order();

        OrderUserControlTitle = "Nieuwe bestelling toevoegen";
    }
    else
    {
        Order = order;

        SelectedProduct = Products.Find(f => f.Id == Order.ProductId);

        OrderUserControlTitle = "Bestelling aanpassen";
    }
}
0

There are 0 best solutions below