Want to link with my local database using xamarin forms
i want to connect my local sqllite database with my xamarin forms.when i want to connect i create own folder in my system and we cant find out this.pls help me how to connect my local database with xamarin forms application.
See also questions close to this topic
-
Convert CSV file data from any language to English in C#
I would like to convert CSV file data from multi languages such as Spanish, Russian, European etc to English language in C# program.
Convert all characters like Ó, É to English characters.
Thanks.
-
I get an error when solving this problem, How can I fix?
I am trying to solve the Climbstairs problem but in reverse, where I want to know the number of steps I have to take to go down.
I can go down 1, 2, 3 or 4 steps at the same time. That is, if I am at step i, I can go down to step i - a for any of the values 1, 2, 3 or 4 of a.
I have the following code but I don't know what happens:
I got this error: System.IndexOutOfRangeException in this line:
steps[i] += steps[i - a];
Why I have this error?
public static int DownStairs(int n) { int[] steps = new int[n + 1]; steps[n] = 1; steps[n - 1] = 1; for (int i = n-2; i>=0; i--) { for(int a = 1; a<=4; a++) { steps[i] += steps[i - a]; } } return steps[n]; } static void Main(string[] args) { int n = 5; DownStairs(n); }
-
How to delete multiple blank lines in a WPF DataGrid imported from an Excel file
I have a WPF DataGrid which I fill with imported data from an Excel file (*. Xlsx) through a class, the problem is that multiple blank lines are added to the end of the DataGrid that I don't see how to delete. I attach my code.
<DataGrid Name="dgvMuros" Height="210" Margin="8" VerticalAlignment="Top" Padding="5,6" ColumnWidth="50" IsReadOnly="False" AlternatingRowBackground="Azure" GridLinesVisibility="All" HeadersVisibility="Column" Loaded="dgvMuros_Loaded" CellEditEnding="DataGrid_CellEditEnding" ItemsSource="{Binding Data}" HorizontalGridLinesBrush="LightGray" VerticalGridLinesBrush="LightGray" > </DataGrid>
With this method I import the data from the Excel file.
public void ImportarMuros() { ExcelData dataFronExcel = new ExcelData(); this.dgvMuros.DataContext = dataFronExcel; txtTotMuros.Text = dataFronExcel.numMuros.ToString(); cmdAgregarMuros.IsEnabled = false; cmdBorrarMuros.IsEnabled = false; cmdImportar.IsEnabled = false; } public class ExcelData { public int numMuros { get; set; } public DataView Data { get { Excel.Application excelApp = new Excel.Application(); Excel.Workbook workbook; Excel.Worksheet worksheet; Excel.Range range; workbook = excelApp.Workbooks.Open(Environment.CurrentDirectory + "\\MurosEjemplo.xlsx"); worksheet = (Excel.Worksheet)workbook.Sheets["DatMuros"]; int column = 0; int row = 0; range = worksheet.UsedRange; DataTable dt = new DataTable(); dt.Columns.Add("Muro"); dt.Columns.Add("Long"); dt.Columns.Add("Esp"); dt.Columns.Add("X(m)"); dt.Columns.Add("Y(m)"); dt.Columns.Add("Dir"); for (row = 2; row < range.Rows.Count; row++) { DataRow dr = dt.NewRow(); for (column = 1; column <= range.Columns.Count; column++) { dr[column - 1] = Convert.ToString((range.Cells[row, column] as Excel.Range).Value); } dt.Rows.Add(dr); dt.AcceptChanges(); numMuros = dt.Rows.Count; } workbook.Close(true, Missing.Value, Missing.Value); excelApp.Quit(); return dt.DefaultView; } } }
-
Microcharts bar chart rendering label
I have a Microcharts barchart in Xamarin.Forms that displays the number of products entered for each day in this current month.
I am trying to make the x-axis label only be displayed for the 1st, 7th, 14th, 21st, and 28th days of the month. However, currently, the text for the label and value label is not displayed properly and are cut-off. https://imgur.com/a/TKiwWb2
private void DrawChart() { int totalDays = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month); var monthlyProductCounts = new Dictionary<int, int>(); for (int i = 1; i <= totalDays; i++) { var day = new DateTime(DateTime.Now.Year, DateTime.Now.Month, i); var productCount = App.Database.GetDailyCount(day); monthlyProductCounts.Add(i, productCount); } int[] datesArray = new int[] { 1, 7, 14, 21, 28 }; var entries = new List<ChartEntry>(); foreach (var (dayNumber, dailyProductCount) in monthlyProductCounts) { bool containsNumber = datesArray.Contains(dayNumber); if (containsNumber == true) { entries.Add(new ChartEntry(dailyProductCount) { Label = dayNumber.ToString(), ValueLabel = dailyProductCount.ToString(), Color = SKColor.Parse("#004daa") }); } else { entries.Add(new ChartEntry(dailyProductCount) { Label = "", ValueLabel = "", Color = SKColor.Parse("#004daa") }); } } monthlyChartView.Chart = new BarChart { Entries = entries, LabelTextSize = 32f, LabelOrientation = Orientation.Horizontal, ValueLabelOrientation = Orientation.Horizontal, Margin = 20 }; }
Is it possible to make it so that the label text is not cut-off?
-
How to replicate the Apple Card application with Xamarin.Form?
Working on a cross-platform project (Android and iOS ) with Xamarin.Form. I want to be able to implement a customized canvas drawing. As I know, there are two libraries "SkiaSharp or NGraphics", both support drawing on most platforms in a platform independently. However, it seems "SkiaSharp" is support by Microsoft officially. I would replicate apple card application (please see the attached picture) with Xamarin.Form. Which one is better "SkiaSharp or NGraphics"? Please share some experience which implement ross-platform project. Thank you.
Example : Apple card application
-
Xamarin.Forms: can I declare an interface that has to be a ContentView
I want to have an interface that's constrained to being a ContentView in Xamarin.Forms.
I'm thinking of something like this, but this itself doesn't work:
public interface InterfaceThatMustBeAContentView : ContentView { //....interfacey stuff }
I've done web searches for this a lot, but I always run into things talking about interface inheritance and subclass conformance, which aren't what I'm after.
Is there a way to do this?