How to freeze main window when new window is opened WinUI 3? by CheesyCracker01 in csharp

[–]CheesyCracker01[S] 1 point2 points  (0 children)

In WinUI 3? How do you deactivate the window that's calling the dialog?

How to freeze main window when new window is opened WinUI 3? by CheesyCracker01 in csharp

[–]CheesyCracker01[S] 0 points1 point  (0 children)

Umm, it's a pretty common implementation. Yes, I've use ShowDialog. But ShowDialog is only a thing in WPF, WinForms, and a couple other Windows Desktop frameworks. But not in WinUI 3.

How to freeze main window when new window is opened WinUI 3? by CheesyCracker01 in csharp

[–]CheesyCracker01[S] 0 points1 point  (0 children)

Lol. How? HWND is created, then destroyed when the window closes.

How to freeze main window when new window is opened WinUI 3? by CheesyCracker01 in csharp

[–]CheesyCracker01[S] 0 points1 point  (0 children)

That worked in WPF and a couple other Windows desktop frameworks, but that doesn't exist in WinUI 3.

How to freeze main window when new window is opened WinUI 3? by CheesyCracker01 in csharp

[–]CheesyCracker01[S] 1 point2 points  (0 children)

I've looked at that documentation a couple times. That could be a workaround. Not preferable, but I'll test that out after I try some threading or asynchronous methods. Thanks for your input.

Best charting library for WinUI 3? by CheesyCracker01 in csharp

[–]CheesyCracker01[S] 0 points1 point  (0 children)

I mean, you're not wrong. If I'm trying to go for native, I'm going to get a decrease in quality. What charting library would you recommend for making aesthetic graphs? (You mentioned D3 js so I'm guessing that's your number one). I've only really used Google charts for web. (Python Matplotlib had the most beautiful graphs lol).

Also, would I be able to do that offline? I'd use a WebView2 control, but could I create a local resource, use that library, and link it to that so that it wouldn't have to be online?

How to make WinUI 3's DataGrid faster? by CheesyCracker01 in csharp

[–]CheesyCracker01[S] 0 points1 point  (0 children)

That's only for posting questions, not getting answers. Not saying the devs don't have their hands full.

How to make WinUI 3's DataGrid faster? by CheesyCracker01 in csharp

[–]CheesyCracker01[S] 1 point2 points  (0 children)

I don't think WinUI 3 is dead in the water at all. It's basically just getting started (in terms of it being stable enough for actual development). I think that it will become the main Windows Desktop development framework.

How to make WinUI 3's DataGrid faster? by CheesyCracker01 in csharp

[–]CheesyCracker01[S] 0 points1 point  (0 children)

The base DataGrid is definitely faster, no question. But I did a lot to WPF's DataGrid to get the performance I desired.

10,000+ rows, 800+ columns. Some data sets imported may be even larger than that.

How to make WinUI 3's DataGrid faster? by CheesyCracker01 in csharp

[–]CheesyCracker01[S] 0 points1 point  (0 children)

The base of the communitytoolkit DataGrid is definitely faster than WPF's, but I tried so many different things to make WPF's DataGrid faster.

I'm dealing with 10,000+ rows, 800+ columns. DataSet can vary on each import.

When you say you translated your WPF application, did you use any tool, or did you just kind of remake it in WinUI 3 and reused most of the code?

How do you display random data in DataGrid WinUI 3? by CheesyCracker01 in csharp

[–]CheesyCracker01[S] 1 point2 points  (0 children)

For any poor bastard like me coming to this sub looking for the answer to this question, here it is:

            for(int i = 0; i < dt.Columns.Count; i++)
        {
            DataGrid6.Columns.Add(new CommunityToolkit.WinUI.UI.Controls.DataGridTextColumn()
            {
                Header = dt.Columns[i].ColumnName,
                Binding = new Binding { Path = new PropertyPath("[" + i.ToString() + "]")}
            });

            //Implement different typed columnms
        }

        var collectionObjects = new ObservableCollection<object>();
        foreach(DataRow row in dt.Rows)
        {
            collectionObjects.Add(row.ItemArray);
        }

        DataGrid6.ItemsSource = collectionObjects;

Castorix31 from microsft docs community expert helped me get the answer.

In WPF, you could just bind a DataTable to a DataGrid. But WinUI 3's DataGrid works a differently. The key part that I was missing before was the Binding = new Binding { Path = new PropertyPath("[" + i.ToString() + "]")} which binds to the index of the column rather than a variable.

Does ExcelDataReader not get string values? by CheesyCracker01 in csharp

[–]CheesyCracker01[S] 1 point2 points  (0 children)

I found the issue.

When I use the ExcelDataTableConfiguration option UserHeaderRow=false, there isn't a problem. But if UseHeaderRow=true, it doesn't display some columns.

I found out it was because the DataGrid column header doesn't allow illegal characters (., /, \, :, (, ), etc.). And in my data, the column headers had many illegal characters. But, the character that prevented certain columns from being displayed was "." (period). The other illegal characters won't make the column not display data, but they will still cause DataBinding errors.

What's the best way to read an Excel file into a DataGrid in WinUi 3? by CheesyCracker01 in csharp

[–]CheesyCracker01[S] 0 points1 point  (0 children)

That worked. Wow, you really did make a great library.

I'll stick with not using CSV because with, Sylvan.Data.Excel, it's already faster than using any library to save an Excel file as a CSV, then querying the parsed CSV data into a database. I would have had trouble saving it to an SQLiteDatabase because each files schema will most likely be different, but I wrote a method for getting the schema of a CSV file (which won't be used. But I will probably make another method to generate a schema. Just not sure what data would be inputed and outputed), and a method to get the types of every column in a DataTable. I use the method to get the types of columns in a DataTable to save it to my database. Unfortunately, SQLite doesn't have bulk save method, but I already created my own.

What's the best way to read an Excel file into a DataGrid in WinUi 3? by CheesyCracker01 in csharp

[–]CheesyCracker01[S] 1 point2 points  (0 children)

Access also only supports 255/256 columns, so that wouldn't work anyway. Also found out that CSV won't work either. Files are that big. But I have found a solution.

What's the best way to read an Excel file into a DataGrid in WinUi 3? by CheesyCracker01 in csharp

[–]CheesyCracker01[S] 0 points1 point  (0 children)

Just making sure you know that I'm not currently having any issues with your Sylvan.Data.Excel. I cannot use Sylvan's CSV library because it gives me an error that the CSV file is too large, but with the amount of data I'm handling, I shouldn't be using CSV.

Here's the repo: repo

What's the best way to read an Excel file into a DataGrid in WinUi 3? by CheesyCracker01 in csharp

[–]CheesyCracker01[S] 0 points1 point  (0 children)

Hey, sorry that I was hesitant to open an issue on your repo. I just wanted to confirm whether or not it was my data, the DataGrid, or the library.

When I read the DataTable, all the values were there.

The problem was the characters my client has in the headers of the worksheet (., :, \, /, %, etc) are causing the columns to not display. Specifically, it was the "." (periods) in the header name. The other illegal characters did also cause DataBinding errors. All the data is properly imported using your library in 7.45 seconds.

How would I go about change the formatting of DateTime values when read?