Microsoft Q&A

C#

9,473 questions

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.

Browse all C# tags

9,473 questions with C#-related tags

Sort by: Updated
3 answers

Backspace trapped possibly due to alignment or Code bug

Hi below is the code snippet which i have asked previously from a respected member @KOZ6.0 . protected override void OnCreateControl() { base.OnCreateControl(); foreach (DataGridViewColumn column in Columns) …

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,736 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
asked 2023-12-01T10:20:01.1066667+00:00
rahul kumar 565 Reputation points
answered 2023-12-05T08:46:04.6133333+00:00
Jiale Xue - MSFT 13,506 Reputation points Microsoft Vendor
0 answers

Why it asks me to remove the custom control

Dear All, I created a set of custom controls for adding to a form. I found except for the "radioButton" (XradioButton), the other customs controls are normal. When I dragged the XradioButton to a form, it showed "Failed to load the toolbox…

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
asked 2023-12-01T04:27:45.34+00:00
BenTam 1,081 Reputation points
edited a comment 2023-12-05T08:03:25.8166667+00:00
Minxin Yu 8,106 Reputation points Microsoft Vendor
3 answers One of the answers was accepted by the question author.

How to fix AppWindow.TitleBar.SetDragRectangles not working in Windows App SDK 1.4.230822000?

As shown in the image, I wrote these codes, which contain AppWindow.TitleBar.SetDragRectangles, and I'm sure that this code is working correctly, but these codes are not doing what they are supposed to do. Why is this? I would like an answer from…

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
654 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
6,754 questions
asked 2023-09-08T03:59:06.27+00:00
Starcloudsea 60 Reputation points
edited a comment 2023-12-05T08:01:30.19+00:00
JohnDizzle 0 Reputation points
0 answers

Hololens 2 UWP C# App: Issues with Front-Facing Camera at Higher Resolutions (2272x1278) and NV12

I am developing a UWP C# App for the Hololens2. I am trying to access the front facing camera via MediaCapture and MediaFrameReader. So far all is working fine as long as I stick to the resolution of 896x504. As soon as I try to set the resolution to…

Universal Windows Platform (UWP)
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
HoloLens Development
HoloLens Development
HoloLens: A family of Microsoft self-contained, holographic devices that enable engagement with digital content and interaction with holograms in the surrounding environment.Development: The process of researching, productizing, and refining new or existing technologies.
343 questions
asked 2023-12-04T14:38:04.9133333+00:00
Richard 0 Reputation points
commented 2023-12-05T07:48:50.5133333+00:00
Junjie Zhu - MSFT 10,791 Reputation points Microsoft Vendor
2 answers One of the answers was accepted by the question author.

Edit style textbox

Hello static bool isEditModeEnabled = false; private static void Txb1_KeyDown(object sender, KeyEventArgs e) { var txb = (TextBox)sender; if (e.Control && e.KeyCode == Keys.R) …

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,736 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
asked 2023-12-02T14:21:29.3166667+00:00
Ashu seh 60 Reputation points
commented 2023-12-05T07:42:48.6466667+00:00
Ashu seh 60 Reputation points
0 answers

Is the service implementation approach I use according to the MVVM pattern appropriate?

Hello In my project where I apply the MVVM pattern, I use the services in the App constructor method by injecting the services I wrote with the Microsoft.Extensions package. One of them, in its simplest form, is a message display class. I have a class…

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,557 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
asked 2023-12-05T07:34:17.6066667+00:00
fatih uyanık 20 Reputation points
1 answer One of the answers was accepted by the question author.

Should I resize the canvas

Dear All, On a WindowsFormControlLibrary project, when I add a UserControl, a canvas is shown. After adding a button, should I resize the canvas? Which of the following is right? Adding a button on the canvas (canvas not resized) Resizing the canvas …

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
asked 2023-12-02T17:08:27.3666667+00:00
BenTam 1,081 Reputation points
accepted 2023-12-05T07:30:11.7266667+00:00
BenTam 1,081 Reputation points
0 answers

Reading text from IInputStream

I have an IInputStream Interface (Windows.Storage.Streams) object. It has text. That is all I know. I just want to read the text. I do not see how to determine the length of the text. It is not being read asynchronously therefore the length should be…

Universal Windows Platform (UWP)
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
asked 2023-12-05T02:25:12.11+00:00
Sam of Simple Samples 5,506 Reputation points
edited the question 2023-12-05T07:14:58.6966667+00:00
Jiale Xue - MSFT 13,506 Reputation points Microsoft Vendor
0 answers

Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: NoSuchMember when trying to call class instance method in Release

Hello, I am writing a C# .NET 7 macOS app, and I'm trying to call a class instance method from another class that had the instance passed to its constructor. I can call one method just fine, but the other method only works in Debug, not in…

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,175 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
asked 2023-12-04T13:10:54.98+00:00
Taylor Fox 0 Reputation points
edited a comment 2023-12-05T07:14:16.4266667+00:00
Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 23,391 Reputation points Microsoft Vendor
0 answers

How to remove classes from multiple projects simultaneously?

I have a Windows Forms App(.NET Framework) which consists over 50 existing projects(all of them are Windows Forms App(.NET Framework)). All of them have common classes added as a link from local server. I need to remove all the linked classes at once. Is…

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,098 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
asked 2023-12-05T07:01:13.0033333+00:00
Vishwaram P 0 Reputation points
1 answer

How to fill a Form.RTF with a Controls.RTF

I need to fill a document RTF (System.Windows.Forms.RichtextBox) from a Richtextbox (System.Windows.Control.RichTextbox). This because for printing. Actually I've done a class for printing RTF (Forms) with texts and images but I don't know how to print a…

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,736 questions
Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,557 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
asked 2023-12-04T07:36:12.7133333+00:00
Paolo Mossa 141 Reputation points
commented 2023-12-05T06:59:15.22+00:00
Hui Liu-MSFT 23,216 Reputation points Microsoft Vendor
1 answer

winui 3 FindAncestor

Hello: In Wpf , The below code in a page/usercontrol will get the property value from MainWindow Datacontext. <TextBlock Text="{Binding DataContext.Arr[2],RelativeSource={RelativeSource Mode=FindAncestor,…

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
654 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
asked 2023-12-03T15:07:45.8366667+00:00
Simon Ong 21 Reputation points
commented 2023-12-05T06:51:11.3633333+00:00
Jeanine Zhang-MSFT 7,696 Reputation points Microsoft Vendor
6 answers

.NET 6 Core Web App Returns web page not found

I am copying over from Stack: I have searched around here and other places to figure out the issue, but I can't find a good solution. I created a new .NET Core Web App targeting .NET6. I created the project without authentication and without Docker…

ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
3,768 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
asked 2022-03-13T22:33:29.183+00:00
Jacaru Tech 31 Reputation points
answered 2023-12-05T06:41:08.2533333+00:00
Premchandra Singh 0 Reputation points
0 answers

System.ArgumentException: Value does not fall within the expected range.

I am making an Excel Addin in C# in Visual Studio. I have already made another simpler Addin and installed it with no problem. But on this one I am getting the following error: “Name: ExcelAddin_RSMeansV.2 From: file:///C:/Users/jstebbins/Desktop/Excel…

Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
1,092 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
3,049 questions
Microsoft 365 Publishing
Microsoft 365 Publishing
Microsoft 365: Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line. Publishing: The process of preparing, producing, and releasing content for distribution or sale.
571 questions
asked 2023-12-05T03:02:02.8933333+00:00
Joshua S 0 Reputation points
edited the question 2023-12-05T05:58:15.2+00:00
Anna Xiu-MSFT 20,331 Reputation points Microsoft Vendor
1 answer

warning MA002: Starting with .NET 8, setting <UseMaui>true</UseMaui> does not automatically include NuGet package references in your project.

I get the following warnings in my iOS project. What should I change in my project? /usr/local/share/dotnet/packs/Microsoft.Maui.Sdk/8.0.0-rc.2.9511/Sdk/BundledVersions.targets(80,5) : warning MA002: Starting with .NET 8, setting …

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,098 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,175 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
asked 2023-12-03T18:15:03.26+00:00
Kim Strasser 641 Reputation points
answered 2023-12-05T05:50:58.0166667+00:00
Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 23,391 Reputation points Microsoft Vendor
1 answer One of the answers was accepted by the question author.

How Can i make a MaterialdesignFloatingHintTextBox's Hint to always float at the top in WPF C#

How can i make a materialdesignFloatingHintTextBox's hint property always float at the top of the textbox regardless of where the textbox is empty or not. Here is my Project with no Code Behind XAML; <Window…

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,557 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
asked 2023-12-04T13:39:48.33+00:00
Mesh Ka 160 Reputation points
accepted 2023-12-05T05:41:50.52+00:00
Mesh Ka 160 Reputation points
1 answer

Bind View Model Property To User Control Dependency Property

Hello Guys! I am fairly new to the WPF eco system, but i already made some functioning dependency properties inside user controls, which can be bound successfully, and which updates, when the bound property inside the view model changes. For now i just…

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,557 questions
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,098 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
XAML
XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
708 questions
asked 2023-11-29T13:43:49.99+00:00
Rauter Martin 0 Reputation points
edited an answer 2023-12-05T05:34:15.1+00:00
Peter Fleischer (former MVP) 18,466 Reputation points
3 answers

How to fix update problem in concurrent request in ASP.NET Web API 2

I am working on an ASP.NET Web API 2 project with .NET Framework 4.6.2. When I send two concurrent requests with the same parameters from Postman, only one record is updated in the database, even though there should be two. I have included screenshots of…

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
1,721 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
ASP.NET API
ASP.NET API
ASP.NET: A set of technologies in the .NET Framework for building web applications and XML web services.API: A software intermediary that allows two applications to interact with each other.
256 questions
asked 2023-12-04T15:39:18.34+00:00
Cenk 911 Reputation points
answered 2023-12-05T05:13:58.1566667+00:00
Cenk 911 Reputation points
1 answer

'System.MissingMethodException: Method not found: 'System.String Microsoft.SharePoint.Client.Site.get_Classification()' in csom package

I'm facing method not found exception while accessing the some properties in Microsoft.SharePoint.Client.Site

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
8,569 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
asked 2023-11-06T12:33:55.8533333+00:00
Dineshkumar T 0 Reputation points
commented 2023-12-05T05:13:17.9733333+00:00
RaytheonXie_MSFT 26,876 Reputation points Microsoft Vendor
0 answers

Rainbow Border effect for Window Frame is missing some colors

i tried to port Windows Terminal Window rainbow border effect from here terminal codes is in c++ and i am working with c# and…

Windows App SDK
Windows App SDK
A set of Microsoft open-source libraries, frameworks, components, and tools to be used in apps to access Windows platform functionality on many versions of Windows. Previously known as Project Reunion.
654 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
9,473 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
6,754 questions
asked 2023-12-04T16:02:31.42+00:00
Mahdi Hosseini 40 Reputation points
commented 2023-12-05T04:54:22.8+00:00
Mahdi Hosseini 40 Reputation points