Argument not specified for parameter

跟風遠走 提交于 2019-12-02 03:11:33

Below code block given on blog post you are referring to has incorrect usage shown.

using (OverlayAdorner<ProgressMessage>.Overlay(LayoutRoot)) 
{ 
   // Do some stuff here while adorner is overlaid
}

Should be (in C#):

using (OverlayAdorner<ProgressMessage>.Overlay(LayoutRoot, this)) // Here I assume `this` is somehow `UserControl`'s object
{ 
   // Do some stuff here while adorner is overlaid
}

In VB.NET

Using OverlayAdorner(Of UserControl).Overlay(G1, UserControl1)
   ' Do some stuff here while adorner is overlaid
End Using

Also note that: OverlayAdorner(Of UserControl1) should be OverlayAdorner(Of UserControl) because T here should be Type's name not name of object instance.

I hope that helps.

Some preaching

From this question of yours I get hint that you need to work yourself on language more. Give more time to VB.NET or C#.NET and use intellisense in Visual Studio to get yourself familiar with the class library and parameter types to be passed into methods you use. This will help you working in new class libraries which have some to no documentation.

I use this shortcut more when working in new class libaries. Type ctrl+k then ctrl+i. Generally said as ctrl+k,i

Update

Based on recent comment, Check the actual usage below:

XAML snippet:

<Window x:Class="WpfTestApp.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Grid x:Name="G1">
        <UserControl x:Name="ucMyControl"></UserControl>
    </Grid>
</Window>

Code behind snippet:

Using OverlayAdorner(Of UserControl).Overlay(G1, ucMyControl)
   ' Do some stuff here while adorner is overlaid
End Using
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!