Hey,
Some updates ago this stopped working (it used to work):
if (Control != null) { Control.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Black); }
Because "Foreground" is not available.
This won't work as well:
if (Control != null) { ListPicker picker = Control as ListPicker; picker.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Colors.Black); }
The renderer is correctly written. It used to work some updates ago.
How can i access the text color now?
Thanks in advance
@PedroNeves.7715 - The ListPicker in WP change in a recent update (1.5.1 I think). They did this to expose more of the controls involved in the ListPicker. You can get access to the ListPicker as such
((ListPicker)((System.Windows.Controls.Grid)this.Control).Children[0])
It should still work as usual. Try putting your custom picker on a blank page and see if its the picker or the layout of your page that is the issue. Just to confirm.
Answers
@PedroNeves.7715 - The ListPicker in WP change in a recent update (1.5.1 I think). They did this to expose more of the controls involved in the ListPicker. You can get access to the ListPicker as such
((ListPicker)((System.Windows.Controls.Grid)this.Control).Children[0])
Thank you. I suppose it worked, as it does not throw an exception. The thing is, i do not know if it did. The picker just won't show up in Windows Phone. Is it somehow hidden or size 0 by default? Although i tried changing both of those properties in the custom renderer and it still does not show. This used to work...
My custom renderer:
The Forms classe:
The XAML:
It should still work as usual. Try putting your custom picker on a blank page and see if its the picker or the layout of your page that is the issue. Just to confirm.
It disappears when i set the HorizontalOptions to FillAndExpand. Even in a blank page.
Still, thanks