Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

C# Error received when binding in Xaml

jv1597

Coder
I get the following error when trying to bind a simple Xaml TextBlock object to C#:
Error Message: "Exception Unhandled: 'Microsoft.ui.xaml.dll' or one of its dependecies: The specified module could not be found. (0x8007007E)"

The App.g.i.cs file brought up highlights 'XamlCheckProcessRequirements();' in its code. I'm using Visual Studio to bind a xaml object to a data-type returned by a simple function 'View1'. Here is what I have coded so far:

Xaml Code:
Code:
<Grid Width="Auto" Height="Auto" Background="#1f1f1f">
    <TextBlock Text="{Binding View1}"></TextBlock>
</Grid>


C# Code:
Code:
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;


namespace drawing_board
{

    public sealed partial class MainWindow : Window
    {
        public MainWindow()
        {
            this.InitializeComponent();
        }

        ViewModel1 viewModel1 = new ViewModel1();

        class ViewModel1
        {
            public static double View1()
            {
                double num1 = 321;
                double num2 = 654;
                double sum = num1 + num2;
                return sum;
            }
        }
    }
}

I tried instantiating the class for the binding context as shown with 'ViewModel1 viewModel1 = new ViewModel1();'. I would like to get the data-type value imported as the value for the 'Text' property in 'TextBlock' as shown in the xaml code above. I would like to know why the binding code is throwing an exception.
 
I get the following error when trying to bind a simple Xaml TextBlock object to C#:
Error Message: "Exception Unhandled: 'Microsoft.ui.xaml.dll' or one of its dependecies: The specified module could not be found. (0x8007007E)"

The App.g.i.cs file brought up highlights 'XamlCheckProcessRequirements();' in its code. I'm using Visual Studio to bind a xaml object to a data-type returned by a simple function 'View1'. Here is what I have coded so far:

Xaml Code:
Code:
<Grid Width="Auto" Height="Auto" Background="#1f1f1f">
    <TextBlock Text="{Binding View1}"></TextBlock>
</Grid>


C# Code:
Code:
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;


namespace drawing_board
{

    public sealed partial class MainWindow : Window
    {
        public MainWindow()
        {
            this.InitializeComponent();
        }

        ViewModel1 viewModel1 = new ViewModel1();

        class ViewModel1
        {
            public static double View1()
            {
                double num1 = 321;
                double num2 = 654;
                double sum = num1 + num2;
                return sum;
            }
        }
    }
}

I tried instantiating the class for the binding context as shown with 'ViewModel1 viewModel1 = new ViewModel1();'. I would like to get the data-type value imported as the value for the 'Text' property in 'TextBlock' as shown in the xaml code above. I would like to know why the binding code is throwing an exception.
Hi there,
Are you sure you have that package installed? I would first check under Nuget Package Manager
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom