Xamarin IOS Shell Itemtemplate FlyoutIcon FontAwesome - ios

I have an Xamarin Shell App. I pulled the code straight from MSDN for the Shell Itemtemplate and it works fine an Android but on IOS the FlyoutIcon is not appearing. I have a feeling it has to do with the fact that I am using FontAwesome for Icons. However I have yet to run across any documentation explaining why there would be an issue with IOS. The icons work perfectly everywehre else in the app. Below is the code for the shell item
<!-- ItemTemplate is for ShellItems as displayed in a Flyout-->
<Shell.ItemTemplate>
<DataTemplate>
<ContentView BackgroundColor="Transparent">
<Grid ColumnDefinitions="0.2*,0.8*" Margin="10">
<Image Source="{Binding FlyoutIcon}"
Margin="5"
HeightRequest="20" />
<Label Grid.Column="1"
Text="{Binding Title}"
TextColor="LightSlateGray"
FontAttributes="Bold"
VerticalTextAlignment="Center" />
</Grid>
</ContentView>
</DataTemplate>
</Shell.ItemTemplate>

Related

Accessibility - voiceover not working in swipeviewitems within a bindablelayout - Xamarin.forms iOS

The UI and commands are working fine both in iOS and android. But the accessibility Voice over is not working in iOS.. Also the talkback is working fine for both the swipeitems in Android.
<SwipeView>
<SwipeView.RightItems>
<SwipeItems>
<SwipeItem Text="Favorite"
IconImageSource="favorite.png"
BackgroundColor="LightGreen"
Command="{Binding Command1}" />
<SwipeItem Text="Delete"
IconImageSource="delete.png"
BackgroundColor="LightPink"
Command="{Binding Command2}"/>
</SwipeItems>
</SwipeView.RightItems>
<!-- Content -->
<Grid HeightRequest="60"
WidthRequest="300"
BackgroundColor="LightGray">
<Label Text="Swipe right"
HorizontalOptions="Center"
VerticalOptions="Center" />
</Grid>
</SwipeView>

Scrolling in Xamarin Forms SfListView causes NullReferenceException in iOS Main function

I just had a very weird issue in my app.
I was adding Syncfusion's SfListView to some pages in my app and for some reason, if the first thing I do when a page that uses the SfListView loads is scroll the ListView, I get a NullReferenceException...in the UIApplication.Main() function that gets called in the iOS project's Main class. There's nothing special in that class at all, though.
It gets better. If I do something else first, like dragging and dropping the items in the SfListView to reorder them and then I scroll it, it doesn't throw the exception.
What on Earth could be causing this?
Here is the XAML for one of the pages that uses the SfListView:
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:d="http://xamarin.com/schemas/2014/forms/design"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:syncfusion="clr-namespace:Syncfusion.ListView.XForms;assembly=Syncfusion.SfListView.XForms"
mc:Ignorable="d"
x:Class="Partylist.Views.EventsPage"
Title="Events"
BackgroundColor="White">
<ContentPage.ToolbarItems>
<ToolbarItem IconImageSource="settings_gear.png"
Priority="0"/>
</ContentPage.ToolbarItems>
<ContentPage.Content>
<!--Main layout of the page-->
<StackLayout>
<!--ListView of the events-->
<syncfusion:SfListView x:Name="EventsListView"
SelectionMode="Single"
SelectionGesture="Tap"
SelectionChanged="OnItemSelected"
DragStartMode="OnHold">
<syncfusion:SfListView.DragDropController>
<syncfusion:DragDropController UpdateSource="True"/>
</syncfusion:SfListView.DragDropController>
<syncfusion:SfListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<SwipeView>
<!--Swipe from the right to make some options
appear-->
<SwipeView.RightItems>
<SwipeItems>
<SwipeItem Invoked="OnDelete"
CommandParameter="{Binding .}"
Text="Delete"
BackgroundColor="#ff418b"
IsDestructive="true"/>
<SwipeItem Invoked="OnRename"
CommandParameter="{Binding .}"
Text="Rename"
BackgroundColor="#FF7700"/>
</SwipeItems>
</SwipeView.RightItems>
<!--This is the content that actually appears-->
<StackLayout Padding="20,5">
<Label Text="{Binding EventFolder.Name}"
TextColor="#FF7700"
FontSize="Large"/>
</StackLayout>
</SwipeView>
</ViewCell>
</DataTemplate>
</syncfusion:SfListView.ItemTemplate>
</syncfusion:SfListView>
<!--"New Event" button-->
<Button Text="+ Add New Event"
TextColor="#ff418b"
FontSize="Large"
BackgroundColor="#00ffffff"
Clicked="OnNewEventClicked"/>
<!--The banner at the bottom of the screen that gives tips-->
<Frame BorderColor="#ff418b"
Padding="0"
HeightRequest="75">
<FlexLayout Direction="Row"
AlignItems="Stretch"
JustifyContent="SpaceBetween">
<!--The "Tip" icon-->
<Image Source="tip_icon.png"
Margin="10"
FlexLayout.Basis="50"/>
<!--The short version of the tip-->
<Label x:Name="tipLabel"
VerticalTextAlignment="Center"
TextColor="#bb0099"
FontSize="Medium"
FontAttributes="Bold"
FlexLayout.Basis="240"/>
<!--The button that opens up a screen
with the rest of the tip-->
<Button Clicked="OnMoreClicked"
Text="More"
TextColor="White"
FontAttributes="Bold"
FontSize="Medium"
BackgroundColor="#ff418b"
FlexLayout.Basis="100"/>
</FlexLayout>
</Frame>
</StackLayout>
</ContentPage.Content>
</ContentPage>
Here is the iOS project's Main class:
using System;
using System.Collections.Generic;
using System.Linq;
using Foundation;
using UIKit;
namespace Partylist.iOS
{
public class Application
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, "AppDelegate"); // This is the line that throws the exception.
}
}
}
UPDATE: I just applied the SfListView to a couple more pages in my project and I couldn't type into the entries in the items on those pages' lists or use their SwipeViews (the experimental ones in Xamarin, not the ones from the SfListView) without crashing the app in the same way as above.
I just got rid of the Synfcusion ListView and switched back to the one that Xamarin comes with. #BenReierson said it's a problems with Xamarin, so maybe I'll look into switching back when that bug gets fixed.
Glad to inform that the reported issue “NullReferenceException throws when scrolling the SfListView with DragDropController” has been included in Syncfusion's latest Weekly NuGet release update version 18.2.0.46 which is available for download (https://www.nuget.org/).

How to highlight selected row in a listbox for windows phone

I am trying to highlight the selected row in a list box and I am having difficulty getting it to work. I have looked online and the solutions that I found either involve using style.resources or style.trigger, both of which my program is saying aren't recognized.
The xaml code for my listbox is as follows:
<ListBox x:Name="selectClassCanvas_ListBox" Width="448" Height="488"
SelectionChanged="selectListSelectionChanged" Grid.RowSpan="2"
Canvas.Left="4" Canvas.Top="54" Background="White">
<ListBox.ItemTemplate>
<DataTemplate>
<ListBoxItem Width="450" BorderBrush="Black" BorderThickness="0,0,0,1">
<TextBlock Text="{Binding}" FontWeight="Bold"
Foreground="Black" Height="50"
FontSize="17"/>
</ListBoxItem>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Can someone please give me some instruction on how to get the selected row of a listbox to highlight?

Banner not shown

I started to use advertising control, but I'm going crazy trying to let it work.
I copied PivotPage.xaml from Microsoft Ad Control Sample and made it the starting page in my app, but ad control is not shown (I'm not able to see banner); if I try to run Microsoft app, banner is shown.
So I registered my app on pubCenter and I got an appId and a unitId and tried to use them in my app, but the result is the same: no banner!!
If I try to use my ids in Microsoft app, test banner is shown.
Why using Microsoft example I'm able to see banner and using same page in my app I can't?
Why using my ids, Microsoft app does not show correct banner?
Here is XAML
<!--Pivot Control-->
<controls:Pivot Grid.Row="0" Title="Ad Control Sample">
<!--Pivot item one-->
<controls:PivotItem Header="piv 1">
</controls:PivotItem>
<!--Pivot item two-->
<controls:PivotItem Header="piv 2">
</controls:PivotItem>
<!--Pivot item three-->
<controls:PivotItem Header="piv 3">
</controls:PivotItem>
</controls:Pivot>
<StackPanel Grid.Row="1" VerticalAlignment="Bottom" >
<TextBlock Text="This is the same ad."
TextWrapping="Wrap"
HorizontalAlignment="Stretch"
TextAlignment="Center" />
<my:AdControl Name="adControl1"
ApplicationId="test_client"
AdUnitId="Image480_80"
HorizontalAlignment="Center"
Width="480" Height="80" />
</StackPanel>
I finally managed to solve my problem and I want to share solution.
I add an event handler for ErrorOccurred on ad control and reading Microsoft.Advertising.AdErrorEventArgs e I realized that my manifest (WMAppManifest.xml) was missing
<Capability Name="ID_CAP_IDENTITY_USER" />
<Capability Name="ID_CAP_MEDIALIB" />
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />

Windows Phone ListBox/ScrollView control won't update

I'm new to Windows Phone 7.1 development. I work in VB.NET.
I'm working on an application similar with 'How to: Create a Basic Local Database Application for Windows Phone'.
I've managed to write the add and delete code using the sample above.
But the update code... when I return to the page where all the data is displayed, it won't update with the new informations. The information is save (submitted), because when I view the records details in a separate page, they are there.
The XAML page code where all the data is displayed is this:
<ScrollViewer Margin="12,148,12,90" Name="scrollViewerVendors">
<ItemsControl ItemsSource="{Binding AllVendors}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border BorderThickness="1" CornerRadius="12" Margin="2">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="0" Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="{Binding Name}" FontSize="28" />
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="{Binding Address}" />
</StackPanel>
<Button Grid.Row="0" Grid.Column="1" Grid.RowSpan="2"
x:Name="EditVendorButton"
BorderThickness="1"
Click="EditVendorButton_Click">
<Image Source="/Images/AppBar/appbar.edit.rest.png" />
</Button>
<Button
Grid.Row="0" Grid.Column="2" Grid.RowSpan="2"
x:Name="DeleteVendorButton"
BorderThickness="1"
Click="DeleteVendorButton_Click">
<Image Source="/Images/AppBar/appbar.delete.rest.png" />
</Button>
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
The update code I've written in the Edit page:
Using DemoAppDB As New DemoAppContext.DemoAppContext("Data Source=isostore:/DemoApp.sdf")
Dim CurrentVendor = From VendorDetails In DemoAppDB.Vendors Where VendorDetails.VendorID = CInt(sVendorID) Select VendorDetails
For Each Vendor In CurrentVendor
Vendor.Name = TextBox1.Text
Vendor.Address = TextBox2.Text
Vendor.ContactPerson = TextBox3.Text
Vendor.Phone = TextBox4.Text
Vendor.Email = TextBox5.Text
Vendor.Notes = TextBox6.Text
Next
'Save changes to the database
DemoAppDB.SubmitChanges()
End Using
The VendorID is passed successfully betweend pages. I've checked.
The database updates, but I can't seem to get the ScrollView record to update. I've also tried with a ListView control.. same result.
The model class Implements INotifyPropertyChanged, INotifyPropertyChanging.
The viewmodel class Implements INotifyPropertyChanged.
If you need any other details, please ask me. Thank you for reading this!
Having had a look at the tutorial I'd say you've missed off
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
// Define the query to gather all of the to-do items.
var toDoItemsInDB = from ToDoItem todo in toDoDB.ToDoItems
select todo;
// Execute the query and place the results into a collection.
ToDoItems = new ObservableCollection<ToDoItem>(toDoItemsInDB);
// Call the base method.
base.OnNavigatedTo(e);
}
where, for you, you'd be updating AllVendors.
What is happening here is that, after the app has navigated back to the main page it is reloading the ObservableCollection that holds the data.

Resources