Xamarin Forms ListView selection-background paints over an item-background - ios

For a xamarin forms project on my iPhone/iOS (12.4), I'm using ItemTemplate to showing ViewCells of a ListView.
This looks like this:
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid>
...
<Frame
BackgroundColor="{Binding Value, Mode=OneWay, Converter={StaticResource PositionToBackgroundColorConverter}}"
BorderColor="{Binding Value, Mode=OneWay, Converter={StaticResource PositionToTextColorConverter}, ConverterParameter={x:Static model:ItemComponent.Border}}">
...
This works pretty fine, sofar a selected item is not set. When I select an item, the selected row are drawing by the framework, and its background is set to gray. In this state the background of the frame is not drawn correctly. Or the background of the selection "overpainting" the background of the frame.
Do you know a (simple?) method to redraw the Frame, after the selected item is changed?
EDIT:
For example, to easier understanding the problem, I put here an image with two ViewCells. The first ListItem is not selected, the second ListItem is selected. This is a symbolic illustration of unwanted behavior!
When the ListItem is selected it should looks like this here:

Related

Xamarin.Forms on iOS: Shrink height of page instead of shifting it up when the softkeyboard appears

Got the problem that the softkeyboard overlaps an entry field placed at the bottom.
XAML code:
<ContentPage.Content>
<AbsoluteLayout VerticalOptions="Fill">
<ScrollView AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0,0,1,0.9">
<Label Text="Heading" />
</ScrollView>
<Entry x:Name="SearchEntry" AbsoluteLayout.LayoutBounds=".5,1,1,.1" AbsoluteLayout.LayoutFlags="All" Placeholder="Suchen..." ReturnType="Done" />
</AbsoluteLayout>
</ContentPage.Content>
I installed the KeyboardOverlap! plugin via nuget. It shifts the whole page upwards till the entry is visible again. The entry is visible, but the top of the page isn't visible anymore because it's shifted up.
Another often mentioned solution is wrapping the pages's content in a ScrollView. Because I definitively need an AbsoluteLayout as root content, that's unfortunately not a solution.
I'm looking for a solution which shrinks the height of the page and don't just shifts it up when the softkeyboard appears.
Why I need this? The page is filled dynmically with search result based on the entrie's input. If there are only few result, they're not visible because of the page's upward shift. The user could think that there aren't any search results. Displaying a text like 'No search results.' above the entry would be a simple solution but is not an option here.
Using this CustomRenderer class in the iOS project instead of the KeyboardOverlap plugin did the trick.
Don't forget to customize line 14 with your concrete page classname(s) where you need the functionality. Otherwise the renderer is called for all pages in your app!
Many thanks to Jack Hua - MSFT!

How put an image in ace:linkButton instead text value (icefaces)?

I'm trying to insert an image that will work like a button. With component ice:commandLink all work fine.
<ice:commandLink partialSubmit="true"
title="#{controller.description}"
actionListener="#{controller.actionPerformed}"
styleClass="toolbarButtonText"
immediate="#{controller.action.immediate}"
>
<h:graphicImage value="#{controller.icon!=null?(controller.icon):(sessionContext.styleManager.zeroIcon)}"
border="0" alt="#{controller.description}"/>
<h:outputText value="#{controller.title}"
rendered="#{controller.icon==null}"/>
</ice:commandLink>
But when I try to replace the component with the ace, the picture becomes not clickable, and the click is now triggered on that line, which is specified in the value (by defaul "Default Anchor Label"). How can a remove all text and make picture like a button?
In my case, I do not need to use the ice component and that the page does not reboot after I click the button.

Setting the label of a paper-icon-button

Previous to the current paper-element release 0.6.., I was able to do the following
<paper-icon-button
id='add-btn'
class='margin-l-t-r-2'
label='LANGUAGE'
icon='menu'
on-click='{{toggle}}'>
</paper-icon-button>
and the button would contain both the icon and the label.
Now the label is not displayed, only the icon on the button. Any help is appreciated in how can I get both label and icon on the button.
Yeah, this has been different in PolymerJS for a while now. They're starting to do things as child elements more often, like this:
<paper-button>
<core-icon icon="favorite"></core-icon>
label goes here
</paper-button>
Docs here: https://www.polymer-project.org/docs/elements/paper-elements.html#paper-button
Note that the <paper-icon-button> was probably always intended to be used just for icons. If you want an icon and a label, <paper-button> is the way to go, as per my example.

WPF Binding Confusion, combo box trying to change selected value before values loaded?

Why isnt this selected value binding working? I am utterly confused here. When I load the page, the first text box properly shows the contents of 'SelectedComponentAnalysisViewModel.ReacEffectViewModel.Note.NoteID', in this case '20'.
What SHOULD happen is when the page is first loaded, the combobox should have the note with ID 20 preselected.
However, the combobox and the second text box are both empty (but the list of notes is populated). As soon as I selected an entry, the 2nd combobox is updated with the newly selected Note ID.
This only happens when the page is first loaded. As soon as I select a different SelectedComponentAnalysisViewModel it all works fine and the appropriate value is automatically selected in the combobox.
My only guess here is that somehow the combobox is trying to bind to the selected value before it is populated. Is there some way to force it to wait till its populated to bind? Or at least make it try to bind after it has been populated? Or maybe the reverese is happening and its trying to load before its datasource is loaded? But if that were the case, then I would expect the first text box to be empty.
(the text boxes are just there to help me debug this)
<ComboBox x:Name="ReactionEffectNoteSelector" ItemTemplate="{DynamicResource DataTemplate1}" ItemsSource="{Binding NoteViewModelList}" SelectedValuePath="NoteID" SelectedValue="{Binding SelectedComponentAnalysisViewModel.ReacEffectViewModel.Note.NoteID, Mode=OneWay}">
<ComboBox.Resources>
<DataTemplate x:Key="DataTemplate1">
<TextBlock TextWrapping="Wrap" Text="{Binding NoteID, Mode=OneWay}"/>
</DataTemplate>
</ComboBox.Resources>
</ComboBox>
<TextBlock HorizontalAlignment="Right" Text="{Binding SelectedComponentAnalysisViewModel.ReacEffectViewModel.Note.NoteID}"/>
<TextBlock HorizontalAlignment="Right" Text="{Binding SelectedValue, ElementName=ReactionEffectNoteSelector, Mode=OneWay}"/>
Why are you binding the SelectedValue to SelectedComponentAnalysisViewModel.ReacEffectViewModel.Note.NoteID and then setting SelectedValuePath to NoteID? That implies that there is a SelectedComponentAnalysisViewModel.ReacEffectViewModel.Note.NoteID.NoteID property.
I think you want to set SelectedValue set to SelectedComponentAnalysisViewModel.ReacEffectViewModel.Note.

Silverlight: Restrict RowDetailsTemplate width to it's parent DataGrid's width

I'd like to bind the Width of my RowDetailsTemplate to the Width of my DataGrid, so that the row details are not surrounded with scroll bars.
Here's the problem:
Notice that the RowDetailsTemplate contains hidden content that must be scrolled into view - which is terrible. The user must drag the scroll bar at the very bottom bottom of the DataGrid in order to see the rest of the row's details - which is very unintuitive. I really want the row details to layout its content such that no scrolling is necessary.
Any suggestions?
Thanks,
Charles
I did find the solution for a similar problem in WPF, you can find it here: DataGrid RowDetails Width problem
I don't know if it works in silverlight, but give it a try.
The answers here felt like a workaround so I did some research and did
find the solution on the Telerik forums, since we use their
RadGridView. Turned out the solution worked for DataGrid as well.
The key is to set the ScrollViewer.HorizontalScrollBarVisibility
property to Disabled, see example below.
<DataGrid ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<DataGrid.RowDetailsTemplate>
<DataTemplate>
<Border>
<TextBlock Foreground="White" Text="{Binding RowDetails}"
TextWrapping="Wrap"/>
</Border>
</DataTemplate>
</DataGrid.RowDetailsTemplate> </DataGrid>
Setting the AreRowDetailsFrozen property on my DataGrid to true solved my problem. Example:
<data:DataGrid AreRowDetailsFrozen="True" />

Resources