As mentioned, I want to toggle the state of a Switch based on the text value changes of a label, i.e. if the text value goes from 0 to 1, switch will change the state from "True" to "False".
I am thinking applying a trigger on Label that will control the state of the switch, but not sure what kind of trigger I should use. Any help is appreciated.
How to change the state of a switch with the change of the text of a Label?
emmanpogi23
Hi, this error always pop out: Unhandled Exception: System.TypeLoadException: Could not resolve type with token 01000007 from typeref (expected class 'Xamarin.Forms.Xaml.XamlResourceIdAttribute' in assembly 'Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null') occurred. Is there somebody who can help me to solve this problem? Thanks
ListView only showing object name
I'm about to pull my hair out. I have a dozen or so other ListViews
that work just fine. I can't figure out what is different about this one. I initially had it more complicated, so I started pairing it down do see if I could isolate the issue, no luck.
XAML:
<ListView ItemsSource="{Binding ItemObsCollection, Mode=OneWay}"
VerticalOptions="FillAndExpand"
HasUnevenRows="true"
IsPullToRefreshEnabled="False"
IsGroupingEnabled="True"
CachingStrategy="RecycleElement"
BackgroundColor="{DynamicResource accentColor}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Label Text="{Binding JobNumber}"/>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
ViewModel:
private ObservableCollection<LabeledEquipmentStatusPost> _itemObsCollection;
public ObservableCollection<LabeledEquipmentStatusPost> ItemObsCollection
{
get => _itemObsCollection;
set
{
if (_itemObsCollection == value) return;
_itemObsCollection = value;
OnPropertyChanged();
}
}
LabeledEquipmentStatusPost
is derived from EquipmentStatusPost
and you guessed it, adds a field that labels it. EquipmentStatusPost
has an Int
field named JobNumber
ActivityIndicator in Stacklayout show error with Invalid arguments
Dear All.
I am new to this forum and I don't know how to post question. I opened discusstion also for this and again I am asking this question.
Please help me in this regards. I get following error in .cs file when I add ActivityIndicator to Stacklayout.
It shows me red line with msg Argument 1: cannot not convert from .ActivityIndicator to Xamarin.Forms.Views.
Below is my code
ActivityIndicator ai = new ActivityIndicator() { IsVisible = true };
StackLayout sl = new StackLayout() {
Spacing = 0,
Margin = new Thickness(0, 0, 0, 0),
Padding = new Thickness(0, 0, 0, 0),
Children = { ai, periodgrid } // error here. Red line appears under ai
};
Thanks and best regards,
Is it possible to load resx file on Runtime dynamically?
If i download resx file as string from remote, is it possible to load on Runtime dynamically? Similar to LoadXaml option that we can load xaml from string? there is ResourceLoader but I am not sure if it related and if yes, how to use it?
Could someone help me how to create a ipa file from visual studio 2017 MAC
I am new to xamarin forms and need some guidance creating an inhouse app IPA file to host on our company portal
Token 01000007 Problem
Hi, this error always pop out: Unhandled Exception: System.TypeLoadException: Could not resolve type with token 01000007 from typeref (expected class 'Xamarin.Forms.Xaml.XamlResourceIdAttribute' in assembly 'Xamarin.Forms.Core, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null') occurred. Is there somebody who can help me to solve this problem? Thanks
Picker shows multiple times
if you have multiple pickers on a page like Picker 1, picker 2 ... when you click on picker 1 and select something it works fine, but if you click and select something from second picker the first picker shows by itself. it is happening in XF 3.4.0.1008975 but it is ok in XF version 3.1.0.583944.
Do we have any fixes on its way?
Navigation bar color is not set 'Transparent' in Xamarin Forms iOS.
I have set Background image for whole application, and set navigation bar background color transparent. In android it's working proper. But in iOS Navigation Bar displays in white color.
ZXingScannerPage
Hi to all,
I am using ZXingScannerPage to scan barcodes.
I have a xaml contect page (myContentPage.xaml).
In code behind, I added ZXingScannerPage in a content page and after scan a popup arrears. So far so good.
My problem is that I do not know how I can put ZXingScannerPage in my contect page (myContentPage.xaml), and after scan, to update labels within myContentPage.xaml.
Do i have to change ZXingScannerPage to something else?
Thanks in advance
iOS app when not debugging will no longer open after a few days
On iOS (iPhone and iPad devices) I can deploy, debug my app fine. The app can also be run without debugging via VS and XCode like published apps can. After a few days my app will not run standalone, it starts up (splash screen shown) then is terminated. Any idea how I can stop this happening?
Reason I ask is I auto provision my business partners iPhone to put the latest app on there once a week, so he can test it as he lives 10 miles away and I have not yet got an Apple dev account so I cannot use something like Test Flight or Hockey App. Same thing happens on my iPhone as seen as I connect it to XCode via VS and debug it works again
Thanks In Advance
Application.Resources StaticResource not found for key
Hi,
I am trying to define a Style for a custom control I have created in the Application.Resources section of my App.xaml.cs file. However the page that references this file raises an exception (StaticResource not found for key).
The sample here :-
https://github.com/xamarin/xamarin-forms-samples
Doesn't use a Key or a Custom Control for it's Application.Resources so I am not exactly sure how to get this working.
Is there any more comprehensive examples available or any pointers as to how to get this working?
Update: The same Style defined in the Page's Resources section, works successfully.
Thanks
Paul Diston
Build an app to runnable
Hey Everyone
I can run app in my device vis USB with visual studio.
But when I am sharing this app,I cant open app and showing error message "app has stopped"
How can I do this app to runnable in all versions of android phone and can share this app
Provide me solution
Thanks
Dynamically change the toolbar icon doesn't work in iOs
On my *.xaml file, I delcare many ToolbarItem and for each item, I declare an "OFF" and a "ON" Item, like this:
<ToolbarItem Text="run"
Order="Primary"
Clicked="OnToolbarItemClicked"
x:Name="run">
<ToolbarItem.Icon>
<OnPlatform x:TypeArguments="FileImageSource"
iOS="run.png"
Android="ic_action_run.png" />
</ToolbarItem.Icon>
</ToolbarItem>
<ToolbarItem Text="run"
Order="Primary"
Clicked="OnToolbarItemClicked"
x:Name="runOn">
<ToolbarItem.Icon>
<OnPlatform x:TypeArguments="FileImageSource"
iOS="run_on.png"
Android="ic_action_run_on.png" />
</ToolbarItem.Icon>
</ToolbarItem>
Then, I created a function to clear and reset the toolbar with the good items, like this :
private void ResetToolbarItems()
{
ToolbarItems.Clear();
if (IsRunning)
ToolbarItems.Add(runOn);
else
ToolbarItems.Add(run);
}
I also tried before to declare only one icon like this :
<ToolbarItem Text="run"
Order="Primary"
Clicked="OnToolbarItemClicked"
x:Name="run">
<ToolbarItem.Icon>
<OnPlatform x:TypeArguments="FileImageSource"
iOS="run.png"
Android="ic_action_run.png" />
</ToolbarItem.Icon>
</ToolbarItem>
and change it when OnToolbarItem was triggered :
async void OnToolbarItemClicked(object sender, EventArgs args)
{
ToolbarItem toolbarItem = (ToolbarItem)sender;
if (toolbarItem.Text == "run")
{
IsRunning= !IsRunning;
ShowRunningIcon(toolbarItem);
}
}
There was my ShowRunningIcon :
private void ShowRunningIcon(ToolbarItem toolbarItem)
{
if (IsRunning)
Device.OnPlatform( iOS: () => toolbarItem.Icon = "run_on.png",
Android: () => toolbarItem.Icon = "ic_action_run_on.png");
else
Device.OnPlatform( iOS: () => toolbarItem.Icon = "run.png",
Android: () => toolbarItem.Icon = "ic_action_run.png");
}
This is working on Android, but in iOs, the icon is not changing dynamically.
Could anybody help me with that?
Thanks,
Phil
How To Solve Unhandled Exception: System.FormatException: Input string was not in a correct format.
I am working on TextChanged event on Entry field. But It is showing Unhandled Exception: System.FormatException: Input string was not in a correct format.
occurred.
Anyone suggect me where i am wrong.
I can't deploy iOS app to simulator or my iPhone
I built an iOS app successfully. When I try to deploy it to debug, I get the following message:
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
Then nothing happens; the app is not deployed to the device.
however, it does say "[Inspector] Error preparing project for inspection" in the output, I dont know if this is preventing the launch/deployment ...
Camera 2 Android
I am looking correct example for using implementing camera2 on android ,
Problem with ListView border in iOS
Hello everyone, I have a simple problem that I can't see where I'm making it wrong, the border between items on my listview has a Margin on the left side that I don't want, can anyone give me some light? Below is the Image and the XAML.
EDIT: I just realized it just have this margin on iOS, on Android is working great.
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="AirSenseApp.View.PlacesMenuPageX"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:b="clr-namespace:Corcav.Behaviors;assembly=Corcav.Behaviors"
Title="Locais">
<b:Interaction.Behaviors>
<b:BehaviorCollection>
<b:EventToCommand Command="{Binding AppearingCommand}" EventName="Appearing" />
</b:BehaviorCollection>
</b:Interaction.Behaviors>
<ContentPage.ToolbarItems>
<ToolbarItem
Command="{Binding CreatePlaceCommand}"
Icon="plusIcon.png"
Order="Primary"
Priority="1" />
</ContentPage.ToolbarItems>
<ContentPage.Content>
<ScrollView>
<StackLayout VerticalOptions="CenterAndExpand">
<ListView ItemsSource="{Binding PlacesList}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.View>
<StackLayout
HeightRequest="60"
HorizontalOptions="StartAndExpand"
Orientation="Horizontal">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="1*" />
<ColumnDefinition Width="1*" />
</Grid.ColumnDefinitions>
<Image
Grid.Column="0"
Aspect="AspectFill"
HeightRequest="50"
Source="{Binding ImageResourceId}"
VerticalOptions="Center"
WidthRequest="50" />
<Label
Grid.Column="1"
FontAttributes="Bold"
FontSize="Large"
Text="{Binding name}"
VerticalTextAlignment="Center" />
<Label
Grid.Column="2"
FontAttributes="Bold"
FontSize="Large"
HorizontalOptions="EndAndExpand"
Text="23°C 49%"
VerticalTextAlignment="Center" />
</Grid>
</StackLayout>
</ViewCell.View>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<Button
Command="{Binding ClearDBCommand}"
Style="{StaticResource acessButtonStyle}"
Text="Limpar BD" />
</StackLayout>
</ScrollView>
</ContentPage.Content>
</ContentPage>
When is it a bad practice to use Value Converter?
In my ViewModel, I have a ObservableCollection of Orders. Order model has statuses like started, finished, cancelled. I bind the collection to a ListView to display the orders and I want to color the row according to the status.
Would it be a good solution and not violate MVVM principles if I would write a value converter to do it? I would map the statuses to the colors and use that value converter when binding the color of a row.
I'm asking this question, because all examples of value converters are very primitive (changing the format of a DateTime and etc.) and my suggested value converter would contain several if statements or a switch.
Are there any other alternative ways to achieve my desired behavior?
How to Use deleteasync method with JSON and URI
hii community....
i Need to delete a record using id
for that purpose i need to pass JSON and URL
but DeleteAsync not considering JSON
How to Solve
if any please reply