MAUI UserAppTheme settings not apply to Picker/Searchbar - picker

Environment: VS 17.4 preview 1, Windows10, System Theme : Dark
To reproduce the bug:
1, Create a new Maui program.
2, added a line
Application.Current.UserAppTheme = AppTheme.Light;
to App.xaml.cs file
3, in mainpage.xaml, build a picker and a searchbar like this:
<StackLayout>
<Border Stroke="Red">
<Picker>
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Item1</x:String>
<x:String>Item2</x:String>
<x:String>Item3</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>
</Border>
<Border Stroke="Blue">
<SearchBar WidthRequest="300"
HeightRequest="50"
Placeholder="input search text"
TextColor="Blue" />
</Border>
</StackLayout>
4, Make sure your system is in Dark theme.
5, Start the program.
you can see, the picker is still in dark panel; if you move mouse over the picker, the text color is changed to WHITE, looks like it disappeared.
The searchbar button is disappeared because it's white.

Related

.net maui Listview ItemSelected not selected when inner elements focused

I have a ListView with one button and one entry on it's ItemTemplate
<ListView
x:Name="LstMedios"
Grid.Row="2"
ItemsSource="{Binding MediosDePago}"
SelectedItem="{Binding MedioPagoSeleccionado,Mode=TwoWay}"
SelectionMode="Single">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid ColumnDefinitions="2*,*" >
<Button
Text="My button"
HeightRequest="40"
HorizontalOptions="FillAndExpand" Margin="5,5" />
<Entry
Text="{Binding NumValor,StringFormat='{0:c}'}"
Keyboard="Numeric"
Grid.Column="1"
HorizontalTextAlignment="End" Margin="0,5,5,5">
</Entry>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
I expect when my Entry is focused then my listview SelectedItem must be set, but it remains null.
What is the proper way to force my listview to automatically set SelectedItem when any of its controls on ItemTemplate is focused?
Full sample
To begin with, what you expect is that when directly hitting on the Button or the Entry(get focused), the SelectedItem below should be triggered.
public TestItem SelectedItem
{
get => _SelectedItem;
set => SetProperty(ref _SelectedItem, value);
}
However, the SelectedItem will only be set if clicking on the frame border or outside of it and the background color of the selected item will be Orange. And this potential issue happens both in ListView and CollectionView.
In conclusion, this potential issue is related or similar to CollectionView's SelectionChanged method cannot be triggered when tapping the item directly #9567. You can try this workaround provided by PhoenixWyllow or follow up on it. Besides, you can also raise a new issue on Github if you are willing to.
Update:
For now, Juan implemented a transparent button over the Entry element this way can get access to selected item posting it from CommandParameter.

Xamarin Forms: How to make each Carousel Page a different Color

I created Carousel view that contains a Collection of Slides. Each slide contains and image, message, and Color. It is stored in an ObservableCollection. I have three colors in the collection. The first slide/page should be yellow, second should be Red, and third should be blue. The issue I have is, when the app initiates all of the slides are blue in the carousel. I need each slide/page to have different colors.
Carousel.ItemsSource = slides = new ObservableCollection<Slides>(new[]
{
new Slides("money", "Some Description", BackgroundColor = Color.Yellow),
new Slides("money", "Some Description2", BackgroundColor = Color.Red),
new Slides("money", "Some Description3",BackgroundColor = Color.Blue)});
<Control:CarouselViewControl x:Name="Carousel"
ShowIndicators="True"
BackgroundColor="{Binding Color}"
CurrentPageIndicatorTintColor="Black">
<Control:CarouselViewControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<ContentView Grid.Row="0" Padding="60,30,60,0">
<Image Source="{Binding Image}" Aspect="AspectFit"/>
</ContentView>
<ContentView Grid.Row="1" Padding="20,50,20,0">
<Label Text="{Binding Message}" TextColor="black"
HorizontalOptions="CenterAndExpand"
FontSize="Large"/>
</ContentView>
</Grid>
</DataTemplate>
</Control:CarouselViewControl.ItemTemplate>
</Control:CarouselViewControl>
I expect each page to have different colors.
You are binding the BackgroundColor for the CarouselViewControl, which will set it for the whole view, not the distinct slides.
Furthermore, the items stored in ItemsSource do not represent any views in the CarouselViewControl, but rather data objects. Just because an object in the ItemsSource collection has a value BackgroundColor, the BackgroundColor of the respective view in the CarouselViewControl ain't set automagically.
To set the background of the pages you'll have to operate from within the DataTemplate and bind the BackgroundColor property of the Grid to the respective property of Slide.
<DataTemplate>
<Grid BackgroundColor="{Binding BackgroundColor}"> <!-- Bind the grids BackgroundColor to the one of the Slide -->
<!-- the grids content -->
</Grid>
</DataTemplate>

Material UI (v1.0) : Force a new line for a TextField

What is the best way to force a new line in a list of TextFields.
For example from the examples :
With <div> tag like this to do your second screen
<div><TextField/></div>
<div><TextField/><TextField/></div>
<div><TextField/></div>
Please import Grid from mui core like this:
import Grid from '#mui/material/Grid';
now inside your component you should wrap your items inside Grid like this:
<Grid
container
direction="column"
justifyContent="center"
alignItems="center"
>
<TextField />
....
</Grid>

GXT Scrollbars hiding fields

I have a verticalLayoutContainer with a fieldset inside it and a FlowLayoutContainer inside that. When I set scroll mode to ALWAYS on the FlowLayoutContainer , the scroll bar is now hiding some of the fields inside.
Screenshots before and after adding scroll attached .
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g="urn:import:com.google.gwt.user.client.ui"
xmlns:c="urn:import:com.sencha.gxt.widget.core.client" xmlns:container="urn:import:com.sencha.gxt.widget.core.client.container"
xmlns:form="urn:import:com.sencha.gxt.widget.core.client.form" xmlns:button="urn:import:com.sencha.gxt.widget.core.client.button"
xmlns:icon="urn:import:com.ffobar.widget">
<ui:with type="com.sencha.gxt.core.client.util.Margins" field="nomargins">
<ui:attributes top="0" right="0" bottom="0" left="0" />
</ui:with>
<ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="verticalLayoutChildData">
<ui:attributes width="1" height="1" margins="{nomargins}"/>
</ui:with>
<ui:with type="com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData" field="verticalLayoutData">
<ui:attributes width="0.32" height="1"/>
</ui:with>
<c:FramedPanel headerVisible="false">
<container:VerticalLayoutContainer layoutData="{verticalLayoutData}">
<container:child layoutData="{verticalLayoutChildData}">
<form:FieldSet headingText="Cross References" collapsible="true" expanded="true" ui:field="fsXref" >
<container:FlowLayoutContainer scrollMode="ALWAYS" ui:field="gcXref" >
<icon:FixedGrid ui:field="grid"></icon:FixedGrid>
</container:FlowLayoutContainer>
</form:FieldSet>
</container:child>
</container:VerticalLayoutContainer>
</c:FramedPanel>
</ui:UiBinder>
There are text fields added to the grid, these text fields are now covered by the H. scroll.
Before
After
You can either put a padding on the right side of your panel to account for the scroll bar or you can use the scrolling support in VLC which has a method adjustForScroll. However, this always adjusts the content to account for the scrollbar, even if there is no scroll bar.
I overcame this issue by checking if a scroll bar was present on the VLC:
boolean hasScroll = container.getScrollSupport().getMaximumVerticalScrollPosition() > 0;
container.setAdjustForScroll(hasScroll);

SAPUI5:Chart: Changing the color of a bar

We would like to change the color of a particular bar in the chart. Can someone share a code snippet to achieve the same? If we use color-pallete aggregation then color change is getting reflected to all the bars.
We are using makit library, please note that we had tried the same with viz library also.
Snippet from XML view:
<ma:Chart id="idChart1" height="50%" width="100%" type="Column"
rows="{/}" showRangeSelector="true"
showTableView="false" showTotalValue="false">
<ma:category>
<ma:Category column="type" displayName="Product" />
</ma:category>
<ma:values>
<ma:Value expression="tickets" displayName="Gross Value"
format="number" />
</ma:values>
<ma:columns>
<ma:Column name="type" value="{BillCycle}" />
<ma:Column name="tickets" value="{Volume}" type="number" />
</ma:columns>`enter code here`
</ma:Chart>
Regards,
DR