0

Why this code is giving error : Name Dictionary does not exist in the namespace xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib" .

<Window x:Class="Test.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
        xmlns:test="clr-namespace:Test"
        Title="MainWindow" Height="350" Width="525">

    <Window.Resources>
        <scg:Dictionary x:Key="CountryPopulRecords" TypeArguments="sys:String,sys:String"></scg:Dictionary>
    </Window.Resources>

    <Grid>

    </Grid>
</Window>    

Reference : MSDN

daniele3004
  • 13,072
  • 12
  • 67
  • 75
AnjumSKhan
  • 9,647
  • 1
  • 26
  • 38

1 Answers1

0

maybe this can help: Create a Dictionary in xaml?

You can't use the Dictionary class directly in XAML, because there's no way to specify the generic type arguments (it will be possible in the next version of XAML, but it won't be supported in VS2010 WPF designer... at least not in the initial release).

However, you can declare a non-generic class that inherits from Dictionary, and use it in XAML.

Community
  • 1
  • 1
ZSH
  • 905
  • 5
  • 15