M.
M.
Explore posts from servers
CC#
Created by M. on 1/15/2024 in #help
✅ How to Retrieve the Selected Item Value from a ComboBox in C# (AvaloniaUI)
Hi, How can I get the value of the selected item in a ComboBox in C# (I'm using AvaloniaUI), please?
22 replies
CC#
Created by M. on 1/12/2024 in #help
✅ Issue with Triggering View Change in Avalonia using C#
Hello 👋, I'm facing an issue in C# with Avalonia, and I could use some help. My current code allows me to change the view (usercontrol) in my MainWindow.axaml, but I'm having difficulties triggering this change from a button inside another view (usercontrol), (
MainWindow.Instance.NavigateTo<ExampleView>();
MainWindow.Instance.NavigateTo<ExampleView>();
). Could someone help me troubleshoot this problem? Part of my code in MainWindow.axaml.cs related to the view change :
c#
public static MainWindow Instance { get; private set; }

public MainWindow()
{
InitializeComponent();
Instance = this;
}
public void NavigateTo<T>() where T : UserControl, new()
{
contentControl.Content = new T();
}
c#
public static MainWindow Instance { get; private set; }

public MainWindow()
{
InitializeComponent();
Instance = this;
}
public void NavigateTo<T>() where T : UserControl, new()
{
contentControl.Content = new T();
}
Relevant code for this from my MainWindow.xaml :
<ContentControl Name="contentControl"/>
<ContentControl Name="contentControl"/>
I'm not entirely sure where the issue is coming from because it was working before. I'm not sure if it's related, but this happened after an update to Avalonia and the libraries in my project. I can't say for certain if that's the cause because I haven't touched the code or the software after doing that update If my issue isn't clear, I can try to explain it better and even create a 'diagram' if needed
22 replies