how to pass parameter from xaml to viewmodel in wpf RRS feed

  • Question

  • Hai 

         I am trying to pass parameter from Xaml to ViewModel

    I use code below


            <ObjectDataProvider  x:Key="BillingVM" ObjectType="{x:Type Local1:BillingVM}">
     <Grid DataContext="{StaticResource BillingVM}">

    in ViewModel

     public string BillType { get; set; }
     public BillingVM(string ty)
                BillType = ty;
    I use 2 ui according to this parameter When I run this code I get parameter passed in BillType

    But My ui is not loading it shows 'Object reference not set to an instance of an object.' Error in


    Please help me what is the problem.





    Monday, April 20, 2020 5:15 PM

All replies

  • https://docs.microsoft.com/answers/topics/wpf.html

    New location of WPF forum...

    Monday, April 20, 2020 8:40 PM