Hi folks, not sure if this is a bug. I'm trying to set the value of a DatePicker control from code. When the DatePicker is in a normal layout, everything works fine. However, if I add the DatePicker to a TableView, the control doesn't seem to redraw and show the changed date. NOTE : I'm testing this in Windows Phone.
This works
class DPPage : ContentPage
{
public DPPage ()
{
Label header = new Label
{
Text = "DatePicker",
Font = Font.BoldSystemFontOfSize(50),
HorizontalOptions = LayoutOptions.Center
};
DatePicker datePicker = new DatePicker
{
Format = "D",
VerticalOptions = LayoutOptions.CenterAndExpand
};
var b = new Button();
b.Text = "Press Me";
b.Clicked += (object sender, EventArgs e) =>
{
datePicker.Date = DateTime.Now;
};
// Build the page.
this.Content = new StackLayout
{
Children =
{
header,
datePicker,
b
}
};
}
}
This doesn't.
class DPPage : ContentPage
{
public DPPage ()
{
Label header = new Label
{
Text = "DatePicker",
Font = Font.BoldSystemFontOfSize(50),
HorizontalOptions = LayoutOptions.Center
};
DatePicker datePicker = new DatePicker
{
Format = "D",
VerticalOptions = LayoutOptions.CenterAndExpand
};
var b = new Button();
b.Text = "Press Me";
b.Clicked += (object sender, EventArgs e) =>
{
datePicker.Date = DateTime.Now;
};
var table_view = new TableView
{
Intent = TableIntent.Form,
Root = new TableRoot("DatePicker")
{
new TableSection("DATE INFO")
{
new ViewCell
{
View = new StackLayout
{
Children =
{
header,
datePicker,
b
}
}
}
}
}
};
// Build the page.
this.Content = new StackLayout
{
Children =
{
table_view
}
};
}
}
}
Interestingly, when the date is changed via clicking the button button, when the date picker is selected , it shows todays date even though the UI in the cell hasn't changed
Anyone else see this behaviour?
regards