.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
1,105 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi,
For xmlns:behaviors="http://schemas.microsoft.com/dotnet/2022/maui/toolkit" which NuGet packet I need to use ?
Thanks,
That namespace is from the MAUI Community Toolkit Search Nuget for CommunityToolkit.Maui. See https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/get-started for information and instructions on how to use it.
Please only post answers as answers. It's generally best to edit updates to the overall scenario into the original post. Posting an answer suggests that you have a solution and don't need more help on this.
See When to use answers or comments
I'm not sure what error you're getting or why. Can you please post the text of the error and your Xaml in your question (use the code tag). Posting images of text are at best hard to read.
The namesapce is: xmlns:behaviors="http://schemas.microsoft.com/dotnet/2022/maui/toolkit"
The error is:
Severity Code Description Project File Line Suppression State
Error XFC0000 Cannot resolve type "http://schemas.microsoft.com/dotnet/2022/maui/toolkit:behaviors:EventToCommandBehavior". AutomationClient.MAUI D:\Applications\AutomationClient\AutomationClient.MAUI\Views\RulesView.xaml 45
You'll need to provide more context on the problem. What you have posted here appears correct, so the source of the error is in something you haven't posted.
To help diagnose, I'd start by wiring up the binding from code instead of XAML to make sure that it works at that level. Once you have that, go back to the XAML and confirm that the xmlns namespace and the actual use in the XAML match (from the xmlns:behaviors and the XFC000 error they appear to do so), and that the BindingContext is set up with a correct command.
Do you have other behaviours in your app that work? Others that don't work? You might want to simplify and test out your behaviour in a simple test app to make sure that everything works there before bringing it over to your main app.
The errror gone after this code
public static class MauiProgram
{
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
// Initialise the toolkit
builder.UseMauiApp<App>().UseMauiCommunityToolkit();
But how I pass the object in command parameter:
<Grid Grid.Row="0" Margin="10" RowDefinitions="auto, *">
<Label Text="Rules" Margin="10" Grid.Row="0"/>
<telerikDataControls:RadListView Grid.Row="1" ItemsSource="{Binding RulesSource}" x:Name="rulesListView" VerticalScrollBarVisibility="Always"
GroupHeaderTemplate="{StaticResource ListViewGroupHeaderTemplate}"
GroupHeaderStyle="{StaticResource ListViewGroupHeaderStyle}">
<telerikDataControls:RadListView.Behaviors>
<behaviors:EventToCommandBehavior
EventName="Loaded"
Command="{Binding RulesLoadedCommand}" />
</telerikDataControls:RadListView.Behaviors>
Sign in to comment