I'm not able to set the "TextColor" of "Picker" to "White".
It turns to white once I select an element but it turns to black as soon as I hover over the control.
<Picker TextColor="White" BackgroundColor="Green" Title="Select a monkey">
<Picker.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Baboon</x:String>
<x:String>Capuchin Monkey</x:String>
<x:String>Blue Monkey</x:String>
<x:String>Squirrel Monkey</x:String>
<x:String>Golden Lion Tamarin</x:String>
<x:String>Howler Monkey</x:String>
<x:String>Japanese Macaque</x:String>
</x:Array>
</Picker.ItemsSource>
</Picker>
Before Hover
After Hover
Related
I tried recreating David Orinaus example of a bottom drawer on Xamarin Forms with DotNet Maui.
Implementation of bottom drawer:
<Grid>
<!-- Backdrop -->
<BoxView Color="#4B000000"
Opacity="0"
InputTransparent="True"
x:Name="Backdrop">
<BoxView.GestureRecognizers>
<TapGestureRecognizer
Tapped="TapGestureRecognizer_Tapped"/>
</BoxView.GestureRecognizers>
</BoxView>
<!-- Bottom Drawer -->
<Frame
x:Name="BottomToolbar"
HeightRequest="200"
VerticalOptions="End"
BackgroundColor="#FFFFFF"
CornerRadius="20"
TranslationY="260"
Padding="15,6">
<Frame.GestureRecognizers>
<PanGestureRecognizer
PanUpdated="PanGestureRecognizer_PanUpdated"
/>
</Frame.GestureRecognizers>
<StackLayout Orientation="Vertical" Padding="0,4">
<BoxView CornerRadius="2" HeightRequest="4" WidthRequest="40"
BackgroundColor="LightGray"
HorizontalOptions="Center"/>
<Label Text="Actions"
HorizontalOptions="Center"
FontSize="18"
FontAttributes="Bold"/>
<TableView Intent="Settings"
VerticalOptions="End"
BackgroundColor="White"
>
<TableSection>
<TextCell
Text="Favorite"/>
<TextCell
Text="Share"/>
</TableSection>
</TableView>
</StackLayout>
</Frame>
</Grid>
Most of the code is the same and this is a sample repository: https://github.com/MaticDiba/MauiAppBottomDrawer
But for some reason, the Bottom drawer is always shown when the page is loaded instead of being hidden until called.
Is there any specific with how DotNet Maui is handling frame views? Any suggestion on how to achieve the same effect with DotNet Maui as this example did with Xamarin?
I am trying to het the same view for portrait and for horizontal. I need the box view to be in the middle of the grey stack layout its ok on portrait but once I switch to horizontal layout the aquamarine box view Is at the end of the stacklayout. How do I get it in the middle for both layouts?
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:AbsolutePath"
x:Class="AbsolutePath.MainPage">
<AbsoluteLayout>
<AbsoluteLayout.Padding>
<OnPlatform x:TypeArguments="Thickness">
<On Platform="iOS">0, 20, 0, 20</On>
</OnPlatform>
</AbsoluteLayout.Padding>
<!--<BoxView Color="LightGray"
AbsoluteLayout.LayoutBounds="0, 0, 1, .35"
AbsoluteLayout.LayoutFlags="All"/>-->
<StackLayout AbsoluteLayout.LayoutBounds=".1, .10, 1, .50" BackgroundColor="LightGray"
AbsoluteLayout.LayoutFlags="All">
<Label Text="$11.95"
TextColor="Black"
FontSize="11"
FontAttributes="Bold"
HorizontalOptions="Start"/>
<BoxView HeightRequest="200" BackgroundColor="Aquamarine" VerticalOptions="Center"
WidthRequest="350"
HorizontalOptions="Center"/>
</StackLayout>
<StackLayout AbsoluteLayout.LayoutBounds="0, 1, 1, .65"
AbsoluteLayout.LayoutFlags="All"
Padding="0, 10, 0, 0">
<Label Text="Transaction History"
FontSize="15"
FontAttributes="Bold"
HorizontalOptions="Center"/>
<ListView>
<ListView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Transaction Item +$15.00 9/9/19</x:String>
<x:String>Transaction Item +$15.00 9/9/19</x:String>
<x:String>Transaction Item +$15.00 9/9/19</x:String>
<x:String>Transaction Item +$15.00 9/9/19</x:String>
<x:String>Transaction Item +$15.00 9/9/19</x:String>
<x:String>Transaction Item +$15.00 9/9/19</x:String>
</x:Array>
</ListView.ItemsSource>
</ListView>
</StackLayout>
</AbsoluteLayout>
</ContentPage>
Scroll bar is not showing in xamarin form version 4.6
here is my code of .xml
<ContentPage.Content>
<ScrollView Orientation="Vertical" VerticalScrollBarVisibility="Always" IsClippedToBounds="True" Scrolled="ScrollView_Scrolled">
<StackLayout Orientation="Vertical" VerticalOptions="StartAndExpand" Padding="30,0,30,0">
<Image HorizontalOptions="Center" WidthRequest="300" Source="change_password_image.png" Margin="0,40,0,40" />
<local:CustomEntry x:Name="txtCurrentPassword" Placeholder="Current Password" TextColor = "White" ReturnType="Next" Keyboard="Text" IsPassword="True"
Margin="0,0,0,10"
WidthRequest="100"
HeightRequest = "50"
PlaceholderColor = "White"
BackgroundColor="#c9c9c9"
HorizontalOptions="FillAndExpand"
FontSize="20"
/>
</StackLayout>
</ScrollView>
</ContentPage.Content>`
I have a CustomCalendar element created by extending the ContentView and using this custom view inside another ContentPage. I tried to use Unfocused event to detect the outside click. But the problem is it is not triggering the event handler. Could you please suggest me to do the detecting of an element outside click in a better way.
I am using my custom view like this way in the page with an Unfocused EventToCommandBehavior
<views:CustomCalendar x:Name="cal">
<views:Calendar.Behaviors>
<prism:EventToCommandBehavior
EventName="Unfocused"
Command="{Binding UnfocusedCalandar}"/>
</views:Calendar.Behaviors>
</views:Calendar>
Unfocused event is raised whenever the VisualElement loses focus, and it only works for the element which is able to receive focus , unfortunately ContentView can't receive focus , so focused and Unfocused event would never trigger on ContentView .
Elements that can receive focus : Entry , Editor , Picker, and so on ...
As a temporary workaround , you could wrap the ContentView into StackLayout, set tap gesture both on ContentView and parenet layout , its own tap gesture will block parent view's gesture .
<StackLayout BackgroundColor="Red" >
<ContentView HeightRequest="100" WidthRequest="100" BackgroundColor="Blue" >
<ContentView.GestureRecognizers>
<TapGestureRecognizer Tapped="ContentViewTap"/>
</ContentView.GestureRecognizers>
</ContentView>
<CollectionView BackgroundColor="Gray" Focused="CollectionView_Focused" >
<CollectionView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Baboon</x:String>
<x:String>Capuchin Monkey</x:String>
<x:String>Blue Monkey</x:String>
<x:String>Squirrel Monkey</x:String>
<x:String>Golden Lion Tamarin</x:String>
<x:String>Howler Monkey</x:String>
<x:String>Japanese Macaque</x:String>
</x:Array>
</CollectionView.ItemsSource>
<CollectionView.ItemTemplate>
<DataTemplate>
<Grid Padding="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Image Grid.RowSpan="2"
Source="dog.png"
Aspect="AspectFill"
HeightRequest="60"
WidthRequest="60" />
<Label Grid.Column="1"
Text="{Binding }"
FontAttributes="Bold" />
<Label Grid.Row="1"
Grid.Column="1"
Text="{Binding }"
FontAttributes="Italic"
VerticalOptions="End" />
<Grid.GestureRecognizers>
<TapGestureRecognizer Tapped="StackLayoutTap" />
</Grid.GestureRecognizers>
</Grid>
</DataTemplate>
</CollectionView.ItemTemplate>
</CollectionView>
<StackLayout.GestureRecognizers>
<TapGestureRecognizer Tapped="StackLayoutTap" />
</StackLayout.GestureRecognizers>
</StackLayout>
If I go from one page RadGridView to the next (by DataPager) I lose the row selection from the previous page.
This is why if I come back, previously selected items will not be selected anymore.
How can I keep selected rows in RadDataGrid?
Code:
<telerik:RadGridView Margin="5" Grid.Row="2"
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
Name="DataGrid"
AutoGenerateColumns="False"
ShowGroupPanel="False"
CanUserDeleteRows="False"
CanUserInsertRows="False"
CanUserFreezeColumns="False"
telerik:StyleManager.Theme="Windows8"
SelectionMode="Extended"
ValidatesOnDataErrors="None"
IsReadOnly="True"
ItemsSource="{Binding View}"
IsBusy="{Binding View.IsBusy}"
RowIndicatorVisibility="Collapsed"
IsSynchronizedWithCurrentItem="False"
FilterOperatorsLoading="DataGrid_FilterOperatorsLoading">
<i:Interaction.Behaviors>
<behaviors:MultiSelectBehavior SelectedItems="{Binding SelectedItems}" />
</i:Interaction.Behaviors>
<telerik:RadGridView.Columns>
<telerik:GridViewSelectColumn/>
<telerik:GridViewDataColumn Header="Производитель" DataMemberBinding="{Binding MakerName}" ShowDistinctFilters="False"/>
<telerik:GridViewDataColumn Header="Номер" DataMemberBinding="{Binding Number}" ShowDistinctFilters="False"/>
<telerik:GridViewDataColumn Header="Наименование" DataMemberBinding="{Binding Name}" ShowDistinctFilters="False"/>
<telerik:GridViewDataColumn Header="Товарная группа" DataMemberBinding="{Binding GroupName}" ShowDistinctFilters="False"/>
<telerik:GridViewDataColumn Header="Вес" DataMemberBinding="{Binding WeightPhysical}" ShowDistinctFilters="False"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
<telerik:RadDataPager Height="28" Grid.Row="3"
NumericButtonCount="20"
Margin="5"
Name="DataPager"
Source="{Binding View}"
telerik:StyleManager.Theme="Windows8"
DisplayMode="All"
Style="{StaticResource RadDataPagerStyle}"
AutoEllipsisMode="None"/>