Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 91519 articles
Browse latest View live

ListView with Entries - Selected Entry Loses Focus when Keyboard Opens

$
0
0

I have a ListView with an ItemTemplate & ViewCell defined in the xaml. My ViewCell contains a grid that has numerous Entry controls. When an Entry is clicked it gains focus, causing the keyboard to open. When the keyboard opens though the selected Entry loses focus and depending on the Android version it either selects the 1st entry in the grid at the top left ( Android 8.1 emulator) or just loses focus and selects nothing at all (9.0 Pixel 3XL).

Through various testing/hack attempts to fix this I've found that what is happening is that when the keyboard opens the ViewCell is recyling and the Entry that was previously selected is not actually in the UI anymore. I have tested this scenario using a very simple ListView with only 2 Entry controls in the ViewCell and nothing else and the same behavior is observed. If I select the 2nd Entry (bottom of StackLayout) it either loses focus and focuses on the 1st one when the keyboard opens, or loses focus completely (depends on Android version).

I feel that I must be missing something or doing something wrong, because this seems like an extremely common scenario and I cannot imagine that this is a bug no one has encountered yet. Below is the XAML for my ListView. This is my 1st post, so I apologize if I have done anything incorrectly.

<ListView x:Name="SetsListView" ItemsSource="{Binding Lifts}"
          VerticalOptions="FillAndExpand"
          HasUnevenRows="true"
          CachingStrategy="RetainElement"
          ItemSelected="SetsListView_ItemSelected"
          BackgroundColor="#383838">
    <ListView.ItemTemplate>
        <DataTemplate>
            <ViewCell>
                <StackLayout Padding="2">
                    <Frame HasShadow="True" OutlineColor="#49C3CB">
                        <StackLayout>
                            <Label Text="{Binding LiftName}" FontAttributes="Bold" FontSize="Large" TextColor="Black"/>
                            <Grid ColumnSpacing="1">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="Auto"/>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="Auto"/>
                                    <RowDefinition Height="{Binding GridHeight[0]}"/>
                                    <RowDefinition Height="{Binding GridHeight[1]}"/>
                                    <RowDefinition Height="{Binding GridHeight[2]}"/>
                                    <RowDefinition Height="{Binding GridHeight[3]}"/>
                                    <RowDefinition Height="{Binding GridHeight[4]}"/>
                                    <RowDefinition Height="{Binding GridHeight[5]}"/>
                                </Grid.RowDefinitions>

                                <Label Text="#" HorizontalTextAlignment="Center" FontAttributes="Bold" TextColor="Black" Grid.Row="0" Grid.Column="0"/>
                                <Label Text="Reps" HorizontalTextAlignment="Center" FontAttributes="Bold" TextColor="Black" Grid.Row="0" Grid.Column="1"/>
                                <Label Text="Weight" HorizontalTextAlignment="Center" FontAttributes="Bold" TextColor="Black" Grid.Row="0" Grid.Column="2"/>
                                <Label Text="RPE" HorizontalTextAlignment="Center" FontAttributes="Bold" TextColor="Black" Grid.Row="0" Grid.Column="3"/>
                                <Label Text="1RM" HorizontalTextAlignment="Center" FontAttributes="Bold" TextColor="Black" Grid.Row="0" Grid.Column="4"/>
                                <Label Text="✔" HorizontalTextAlignment="Center" FontAttributes="Bold" TextColor="Black" Grid.Row="0" Grid.Column="5"/>

                                <Label Text="{Binding Sets[0].SetNumber}" VerticalTextAlignment="Center" TextColor="Black" Grid.Row="1" Grid.Column="0"/>
                                <Entry Text="{Binding Sets[0].RepsCompleted}" TextColor="Black" Keyboard="Numeric" Placeholder="{Binding Sets[0].RepGoal}" PlaceholderColor="LightGray" HorizontalTextAlignment="Center" Grid.Row="1" Grid.Column="1"/>
                                <Entry Text="{Binding Sets[0].WeightCompleted}" TextColor="Black" Keyboard="Numeric" Placeholder="{Binding Sets[0].RecommendedWeight}" PlaceholderColor="LightGray" HorizontalTextAlignment="Center" Grid.Row="1" Grid.Column="2"/>
                                <Entry Text="{Binding Sets[0].RPE}" IsVisible="{Binding Sets[0].IsRPEVisible}" TextColor="Black" Keyboard="Numeric" HorizontalTextAlignment="Center" Grid.Row="1" Grid.Column="3"/>
                                <Label Text="{Binding Sets[0].Estimated1RM}" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" TextColor="Black" Grid.Row="1" Grid.Column="4"/>
                                <Switch IsEnabled="{Binding Sets[0].CanComplete}" IsToggled="{Binding Sets[0].IsComplete}" HorizontalOptions="CenterAndExpand" Grid.Row="1" Grid.Column="5" />

                                <Label Text="{Binding Sets[1].SetNumber}" VerticalTextAlignment="Center" TextColor="Black" Grid.Row="2" Grid.Column="0"/>
                                <Entry Text="{Binding Sets[1].RepsCompleted}" TextColor="Black" Keyboard="Numeric" Placeholder="{Binding Sets[1].RepGoal}" PlaceholderColor="LightGray" HorizontalTextAlignment="Center" Grid.Row="2" Grid.Column="1"/>
                                <Entry Text="{Binding Sets[1].WeightCompleted}" TextColor="Black" Keyboard="Numeric" Placeholder="{Binding Sets[1].RecommendedWeight}" PlaceholderColor="LightGray" HorizontalTextAlignment="Center" Grid.Row="2" Grid.Column="2"/>
                                <Entry Text="{Binding Sets[1].RPE}" IsVisible="{Binding Sets[1].IsRPEVisible}" TextColor="Black" Keyboard="Numeric" HorizontalTextAlignment="Center" Grid.Row="2" Grid.Column="3"/>
                                <Label Text="{Binding Sets[1].Estimated1RM}" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" TextColor="Black" Grid.Row="2" Grid.Column="4"/>
                                <Switch IsEnabled="{Binding Sets[1].CanComplete}"  IsToggled="{Binding Sets[1].IsComplete}"  HorizontalOptions="CenterAndExpand" Grid.Row="2" Grid.Column="5" />

                                <Label Text="{Binding Sets[2].SetNumber}" VerticalTextAlignment="Center" TextColor="Black" Grid.Row="3" Grid.Column="0"/>
                                <Entry Text="{Binding Sets[2].RepsCompleted}" TextColor="Black" Keyboard="Numeric" Placeholder="{Binding Sets[2].RepGoal}" PlaceholderColor="LightGray" HorizontalTextAlignment="Center" Grid.Row="3" Grid.Column="1"/>
                                <Entry Text="{Binding Sets[2].WeightCompleted}" TextColor="Black" Keyboard="Numeric" Placeholder="{Binding Sets[2].RecommendedWeight}" PlaceholderColor="LightGray" HorizontalTextAlignment="Center" Grid.Row="3" Grid.Column="2"/>
                                <Entry Text="{Binding Sets[2].RPE}" IsVisible="{Binding Sets[2].IsRPEVisible}" TextColor="Black" Keyboard="Numeric" HorizontalTextAlignment="Center" Grid.Row="3" Grid.Column="3"/>
                                <Label Text="{Binding Sets[2].Estimated1RM}" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" TextColor="Black" Grid.Row="3" Grid.Column="4"/>
                                <Switch IsEnabled="{Binding Sets[2].CanComplete}"  IsToggled="{Binding Sets[2].IsComplete}"  HorizontalOptions="CenterAndExpand" Grid.Row="3" Grid.Column="5" />

                                <Label Text="{Binding Sets[3].SetNumber}" VerticalTextAlignment="Center" TextColor="Black" Grid.Row="4" Grid.Column="0"/>
                                <Entry Text="{Binding Sets[3].RepsCompleted}" TextColor="Black" Keyboard="Numeric" Placeholder="{Binding Sets[3].RepGoal}" PlaceholderColor="LightGray" HorizontalTextAlignment="Center" Grid.Row="4" Grid.Column="1"/>
                                <Entry Text="{Binding Sets[3].WeightCompleted}" TextColor="Black" Keyboard="Numeric" Placeholder="{Binding Sets[3].RecommendedWeight}" PlaceholderColor="LightGray" HorizontalTextAlignment="Center" Grid.Row="4" Grid.Column="2"/>
                                <Entry Text="{Binding Sets[3].RPE}" IsVisible="{Binding Sets[3].IsRPEVisible}" TextColor="Black" Keyboard="Numeric" HorizontalTextAlignment="Center" Grid.Row="4" Grid.Column="3"/>
                                <Label Text="{Binding Sets[3].Estimated1RM}" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" TextColor="Black" Grid.Row="4" Grid.Column="4"/>
                                <Switch IsEnabled="{Binding Sets[3].CanComplete}"  IsToggled="{Binding Sets[3].IsComplete}"  HorizontalOptions="CenterAndExpand" Grid.Row="4" Grid.Column="5" />

                                <Label Text="{Binding Sets[4].SetNumber}" VerticalTextAlignment="Center" TextColor="Black" Grid.Row="5" Grid.Column="0"/>
                                <Entry Text="{Binding Sets[4].RepsCompleted}" TextColor="Black" Keyboard="Numeric" Placeholder="{Binding Sets[4].RepGoal}" PlaceholderColor="LightGray" HorizontalTextAlignment="Center" Grid.Row="5" Grid.Column="1"/>
                                <Entry Text="{Binding Sets[4].WeightCompleted}" TextColor="Black" Keyboard="Numeric" Placeholder="{Binding Sets[4].RecommendedWeight}" PlaceholderColor="LightGray" HorizontalTextAlignment="Center" Grid.Row="5" Grid.Column="2"/>
                                <Entry Text="{Binding Sets[4].RPE}" IsVisible="{Binding Sets[4].IsRPEVisible}" TextColor="Black" Keyboard="Numeric" HorizontalTextAlignment="Center" Grid.Row="5" Grid.Column="3"/>
                                <Label Text="{Binding Sets[4].Estimated1RM}" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" TextColor="Black" Grid.Row="5" Grid.Column="4"/>
                                <Switch IsEnabled="{Binding Sets[4].CanComplete}"  IsToggled="{Binding Sets[4].IsComplete}"  HorizontalOptions="CenterAndExpand" Grid.Row="5" Grid.Column="5" />

                                <Label Text="{Binding Sets[5].SetNumber}" VerticalTextAlignment="Center" TextColor="Black" Grid.Row="6" Grid.Column="0"/>
                                <Entry Text="{Binding Sets[5].RepsCompleted}" TextColor="Black" Keyboard="Numeric" Placeholder="{Binding Sets[5].RepGoal}" PlaceholderColor="LightGray" HorizontalTextAlignment="Center" Grid.Row="6" Grid.Column="1"/>
                                <Entry Text="{Binding Sets[5].WeightCompleted}" TextColor="Black" Keyboard="Numeric" Placeholder="{Binding Sets[5].RecommendedWeight}" PlaceholderColor="LightGray" HorizontalTextAlignment="Center" Grid.Row="6" Grid.Column="2"/>
                                <Entry Text="{Binding Sets[5].RPE}" IsVisible="{Binding Sets[5].IsRPEVisible}" TextColor="Black" Keyboard="Numeric" HorizontalTextAlignment="Center" Grid.Row="6" Grid.Column="3"/>
                                <Label Text="{Binding Sets[5].Estimated1RM}" VerticalTextAlignment="Center" HorizontalTextAlignment="Center" TextColor="Black" Grid.Row="6" Grid.Column="4"/>
                                <Switch IsEnabled="{Binding Sets[5].CanComplete}"  IsToggled="{Binding Sets[5].IsComplete}"  HorizontalOptions="CenterAndExpand" Grid.Row="6" Grid.Column="5" />
                            </Grid>
                        </StackLayout>
                    </Frame>
                </StackLayout>
            </ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

XAML condition decision

$
0
0

Hi all,

Is it possible to add in XAML some condition checking ?

Like in the following pseudo code:

<ListView
    ItemsSource="{Binding Staffs}"
    HasUnevenRows="True">
    <ListView.ItemTemplate>
        <DataTemplate>
      <!-- How to add condition check for example -->
            <ViewCell>
                <!-- Check condition from context of model the Type of view and if choose the following view -->
                <views:OneView
                    BindingContext="{Binding .}"
                    HorizontalOptions="FillAndExpand"
                    VerticalOptions="FillAndExpand"/>
                <!-- else choose the following view -->
                <views:AnotherView
                    BindingContext="{Binding .}"
                    HorizontalOptions="FillAndExpand"
                    VerticalOptions="FillAndExpand"/>
                <!-- endif -->
            </ViewCell>
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

Local html file as webview.source

$
0
0

Hello still learning here, I have a local html file it's already placed in the assets folder inside another foler called webview, I'm following the guide provided at https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/webview, basically I'm using it to show a background video since I couldn't find a better way to do so in android.

The example as I understand, provides a way to fill the WebView with an HtmlWebViewSource

        var browser = new WebView();
        var htmlSource = new HtmlWebViewSource();

        htmlSource.Html = @"<html>
                            <head>
                            <link rel=""stylesheet"" href=""default.css"">
                            </head>
                            <body>
                            <h1>Xamarin.Forms</h1>
                            <p>The CSS and image are loaded from local files!</p>
                            <img src='XamarinLogo.png'/>
                            <p><a href=""local.html"">next page</a></p>
                            </body>
                            </html>";

        htmlSource.BaseUrl = DependencyService.Get<IBaseUrl>().Get();
        browser.Source = htmlSource;
        Content = browser;

But I just need to do something like WebVideo.Source = Url + "rain" + ".html";
The url is just string Url = "webview/";

The BaseUrl_Android class is already at the android folder and if I use the url in such way it appears like a blank page, all assets are set as androidasset in it's properties
it seems I don't know how to use these lines:

    htmlSource.BaseUrl = DependencyService.Get<IBaseUrl>().Get();
        browser.Source = htmlSource;

Any pointer here will be reatly appreciatted, thanks.

Xamarin form pages stored on Azure Server

$
0
0

Hello, I'm trying to create an app for IOS and Android that loads created xaml pages from a server. There are several of these pages and it would be better that they are accessed by respective devices on load rather than stored locally on the devices as these forms are subject to changes and additional pages will be added frequently. All of the pages referenced will have cs file associated with them that will need to be accessed aswell.
The desired end result is an application that an loads has a list of all active pages/forms and when the user selects one of them, it will open, allow the user to fill it out and send it out.
Does anyone know if this is currently possible?

x:Class mapped to server namespace?

How to pass parameter from Rg.Plugin.Popup to content page?

$
0
0

When I am going to pass parameter from Rg.Plugin.Popup page to a Content page,the content page will reload
so how to accept parameters from popup page to content page?

How to detect Enter KeyPress in Editor?

$
0
0

In my app there is an multiple line Editor.
So when I press the Enter key there is not Complete event to raise.
I want process the KeyPress event in XAML, but there is no KeyPress event can use in XAML.

My app has android and UWP version.
In android because the user can touch the Send button to do the work, so I don't need handle the Keypress event in android.
In UWP because the user will be press the Enter key to do the work, so I need handle the Keypress event in UWP.

I want to use some event which can write in XAML like this:
<Editor KeyPress="SendButton_KeyPress"/>

But I don't know which function or keywords to use.
Some one help me?

加拿大布鲁克大学文凭毕业.证/成绩单#薇信6956.40122办理加拿大Brock毕业.证成绩单;文,凭/留信网认.证/使馆认证公.证

$
0
0

加拿大布鲁克大学文凭毕业.证/成绩单#薇信6956.40122办理加拿大Brock毕业.证成绩单;文,凭/留信网认.证/使馆认证公.证


加拿大渥太华大学文凭毕业.证/成绩单#薇信6956.40122办理加拿大uOttawa毕业.证成绩单;文,凭/留信网认.证/使馆认证公.证

$
0
0

加拿大渥太华大学文凭毕业.证/成绩单#薇信6956.40122办理加拿大uOttawa毕业.证成绩单;文,凭/留信网认.证/使馆认证公.证

加拿大川特大学文凭毕业.证/成绩单#薇信6956.40122办理加拿大川特大学毕业.证成绩单;文,凭/留信网认.证/使馆认证公.证

$
0
0

加拿大川特大学文凭毕业.证/成绩单#薇信6956.40122办理加拿大川特大学毕业.证成绩单;文,凭/留信网认.证/使馆认证公.证

伍斯特理工学院毕业证:”Q/微信695640122,#〔WPI毕业证#WPI成绩单#WPI文凭〕㏇伍斯特理工学院毕业证书买WPI大学留信网认证㏇可查认证

$
0
0

伍斯特理工学院毕业证:”Q/微信695640122,#〔WPI毕业证#WPI成绩单#WPI文凭〕㏇伍斯特理工学院毕业证书买WPI大学留信网认证㏇可查认证

普林斯顿大学毕业证:”Q/微信695640122,#〔Princeton毕业证#Princeton成绩单#Princeton文凭〕㏇普林斯顿大学毕业证书买Princeton大学留信网认证㏇可查认证

$
0
0

普林斯顿大学毕业证:”Q/微信695640122,#〔Princeton毕业证#Princeton成绩单#Princeton文凭〕㏇普林斯顿大学毕业证书买Princeton大学留信网认证㏇可查认证

托莱多大学毕业证:”Q/微信695640122,#〔Toledo毕业证#Toledo成绩单#Toledo文凭〕㏇托莱多大学毕业证书买Toledo大学留信网认证㏇可查认证

$
0
0

托莱多大学毕业证:”Q/微信695640122,#〔Toledo毕业证#Toledo成绩单#Toledo文凭〕㏇托莱多大学毕业证书买Toledo大学留信网认证㏇可查认证

杜克大学毕业证:”Q/微信695640122,#〔Duke毕业证#Duke成绩单#Duke文凭〕㏇杜克大学毕业证书买Duke大学留信网认证㏇可查认证

$
0
0

杜克大学毕业证:”Q/微信695640122,#〔Duke毕业证#Duke成绩单#Duke文凭〕㏇杜克大学毕业证书买Duke大学留信网认证㏇可查认证

芝加哥大学毕业证:”Q/微信695640122,#〔Chicago毕业证#Chicago成绩单#Chicago文凭〕㏇芝加哥大学毕业证书买Chicago大学留信网认证㏇可查认证

$
0
0

芝加哥大学毕业证:”Q/微信695640122,#〔Chicago毕业证#Chicago成绩单#Chicago文凭〕㏇芝加哥大学毕业证书买Chicago大学留信网认证㏇可查认证


加拿大劳伦森大学文凭毕业.证/成绩单#薇信6956.40122办理加拿大Laurentian毕业.证成绩单;文,凭/留信网认.证/使馆认证公.证

$
0
0

加拿大劳伦森大学文凭毕业.证/成绩单#薇信6956.40122办理加拿大Laurentian毕业.证成绩单;文,凭/留信网认.证/使馆认证公.证

加拿大安大略理工大学文凭毕业.证/成绩单#薇信6956.40122办理加拿大UOIT毕业.证成绩单;文,凭/留信网认.证/使馆认证公.证

$
0
0

加拿大安大略理工大学文凭毕业.证/成绩单#薇信6956.40122办理加拿大UOIT毕业.证成绩单;文,凭/留信网认.证/使馆认证公.证

加拿大湖首大学文凭毕业.证/成绩单#薇信6956.40122办理加拿大Lakehead毕业.证成绩单;文,凭/留信网认.证/使馆认证公.证

$
0
0

加拿大湖首大学文凭毕业.证/成绩单#薇信6956.40122办理加拿大Lakehead毕业.证成绩单;文,凭/留信网认.证/使馆认证公.证

达特茅斯学院毕业证:”Q/微信695640122,#〔Dartmouth毕业证#Dartmouth成绩单#Dartmouth文凭〕㏇达特茅斯学院毕业证书买Dartmouth大学留信网认证㏇可查认证

$
0
0

达特茅斯学院毕业证:”Q/微信695640122,#〔Dartmouth毕业证#Dartmouth成绩单#Dartmouth文凭〕㏇达特茅斯学院毕业证书买Dartmouth大学留信网认证㏇可查认证

加拿大湖首大学文凭毕业.证/成绩单#薇信6956.40122办理加拿大Lakehead毕业.证成绩单;文,凭/留信网认.证/使馆认证公.证

$
0
0

加拿大湖首大学文凭毕业.证/成绩单#薇信6956.40122办理加拿大Lakehead毕业.证成绩单;文,凭/留信网认.证/使馆认证公.证

Viewing all 91519 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>