Questions tagged [code-behind]
Code-behind refers to code for your UI (Windows Forms, ASP.NET page, etc.) contained within a separate class file. This allows separation of the UI and the logic behind it.
code-behind
1,971
questions
1
vote
1
answer
30
views
How to fix the status button appearing in the tasks column
The problem: I'm trying to make the status button appear in the respective column but failed.
Image of the table
Steps taken:
just to let you know, the Task column was added manually, here is the ...
0
votes
0
answers
23
views
Is it possible to initiate a method in the App.xml.cs file instead of a content page?
I'm building a .NET Maui app where the user has to initially select a database. So instead of a content page appearing with no data because a database has not been selected, I'm looking to initially ...
1
vote
0
answers
27
views
How do I set a text value of a label in a content page from a view model class?
I'm working on an app where the initial content page has a label control looking like this:
<Label FontSize="Small"
TextColor="White"
...
1
vote
1
answer
86
views
My ObservableCollection<T> in a view model file cannot be seen by other files
I have a view model class in a folder called ViewModel. The file is called PgViewMode.cs and looks like this:
using CommunityToolkit.Mvvm.ComponentModel;
using LockAndKeyMaui.Models;
using ...
0
votes
2
answers
77
views
How can I set a code-behind property from a view model class?
I have my initial content page set up like this:
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml&...
1
vote
2
answers
234
views
Extract block to code behind is no longer available in .NET 8 and Visual Studio 2022
I'm using .NET 8 and Blazor in Visual Studio 2022 and I want to move my C# code to a code behind file. There is supposed to be an option called "Extract block to code behind" if you ...
0
votes
1
answer
76
views
How do I change the size of a window?
I start with an initial content page with a size of 1285 x 800. I'm using shell navigation and I say Shell.Current.Navigation.PushModalAsync(new NewDb());
and in the NewDb content page I have:
...
0
votes
1
answer
56
views
I'm having trouble binding one control to another. Why?
In my XAML file, the content page tag looks like this:
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:toolkit="http://schemas.microsoft.com/...
0
votes
0
answers
63
views
Binding to a calculated property of a BindableProperty from code behind
In short, I have a custom control in Xamarin for which I defined a BindableProperty, which I would like to bind to the control's xaml via a calculated property in the code behind, but it always ...
0
votes
1
answer
59
views
How to Move an Ellipse Along a Path in WPF Code-Behind
I'm trying to move an ellipse along a simple PathGeometry in code-behind. The ellipse shows up. The path shows up. Nothing moves. What am I missing? Thanks!
Here's what I have. SchematicDiagram is a ...
0
votes
1
answer
215
views
WinUI 3 Modify application's MainWindow Title from the Settings page in a NavigationView
I have a winui 3 desktop application running on Windows 10. In the setting page of the navigationview I want to allow the user to change environments and have the environment indicated in the ...
0
votes
1
answer
69
views
how can I know which cell clicked after gridview clicked
I have a PROJECT_EFFORT table.
ProjectId, Year, Month, Effort
1, 2022, 12, 10
2, 2022, 12, 20
2, 2023, 1, 100
2, 2023, 2, 50
2, 2023, 3, 30
3, 2023, 3, 40
3, 2023, 4, 10
3, 2023, 5, 120
4, ...
1
vote
1
answer
108
views
Using `Application.LoadComponent` with dependency injection
I have a XAML file in an F# project. The XAML file is built as a resource (not a BAML-compiled page).
In order to dynamically load the page, I use the Application.LoadComponent method with an ...
-1
votes
1
answer
48
views
Change TabPanel to Visibility.Collapsed in Code-Behind
I am currently experiencing the exact following issue: WPF TabControl collapsed tab headers are not completely hidden (when I collapse the TabItems, I still see a gray line of a few pixels where the ...
0
votes
2
answers
68
views
Need help fixing WPF C# Storyboard in code behind
Using the code sample below, myImage only moves along the Y axis, but not the X. I need myImage to move along both the X and Y axes simultaneously. Image myImage exists in the XAML within a Canvas. ...