2

I am trying to implement Material Design in xaml Toolkit and getting this error

The name "XamlDisplay" does not exist in the namespace "clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML"

i just copied and pasted this code from official docs Xaml code
I have tried solution provided here Other Question on StackOverflow like changing Debug to Release mode ,cleaning shadowCache and DLL file permissions.
But these all are just tricks and are not reliable answers and they don't work for me . whats wrong happening ?
My Xaml code

<Window x:Class="MaterialTestApp.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:MaterialTestApp"
    mc:Ignorable="d"
    xmlns:smtx="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML"
    xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
    TextElement.Foreground="{DynamicResource MaterialDesignBody}"
    TextElement.FontWeight="Regular"
    TextElement.FontSize="13"
    TextOptions.TextFormattingMode="Ideal" 
    TextOptions.TextRenderingMode="Auto"        
    Background="{DynamicResource MaterialDesignPaper}"
    FontFamily="{DynamicResource MaterialDesignFont}">
<Grid>
    <StackPanel Margin="8 8 0 0">
        <TextBlock>Raised controls have default shadows set, but the shadows can be overriden.</TextBlock>
        <StackPanel Orientation="Horizontal" Margin="0 32 0 0">
            <smtx:XamlDisplay Key="shadow_1">
                <Button Style="{DynamicResource MaterialDesignRaisedButton}"
                    >DEPTH 1</Button>
            </smtx:XamlDisplay>
            <smtx:XamlDisplay Key="shadow_2" Margin="16 0 0 0">
                <Button Style="{DynamicResource MaterialDesignRaisedButton}"
                    materialDesign:ShadowAssist.ShadowDepth="Depth2"
                    >DEPTH 2</Button>
            </smtx:XamlDisplay>
            <smtx:XamlDisplay Key="shadow_3" Margin="16 0 0 0">
                <Button Style="{DynamicResource MaterialDesignRaisedButton}"
                    materialDesign:ShadowAssist.ShadowDepth="Depth3"
                    >DEPTH 3</Button>
            </smtx:XamlDisplay>
            <smtx:XamlDisplay Key="shadow_4" Margin="16 0 0 0">
                <Button Style="{DynamicResource MaterialDesignRaisedButton}"
                    materialDesign:ShadowAssist.ShadowDepth="Depth4"
                    >DEPTH 4</Button>
            </smtx:XamlDisplay>
            <smtx:XamlDisplay Key="shadow_5" Margin="16 0 0 0">
                <Button Style="{DynamicResource MaterialDesignRaisedButton}"
                    materialDesign:ShadowAssist.ShadowDepth="Depth5"
                    >DEPTH 5</Button>
            </smtx:XamlDisplay>
        </StackPanel>
        <StackPanel Orientation="Horizontal" Margin="0 32 0 0">
            <smtx:XamlDisplay Key="shadow_6">
                <Button Style="{DynamicResource MaterialDesignFloatingActionMiniButton}"
                    materialDesign:ShadowAssist.ShadowDepth="Depth1"
                    >1</Button>
            </smtx:XamlDisplay>
            <smtx:XamlDisplay Key="shadow_7" Margin="16 0 0 0">
                <Button Style="{DynamicResource MaterialDesignFloatingActionMiniButton}"
                    materialDesign:ShadowAssist.ShadowDepth="Depth2"
                    >2</Button>
            </smtx:XamlDisplay>
            <smtx:XamlDisplay Key="shadow_8" Margin="16 0 0 0">
                <Button Style="{DynamicResource MaterialDesignFloatingActionMiniButton}"
                    materialDesign:ShadowAssist.ShadowDepth="Depth3"
                    >3</Button>
            </smtx:XamlDisplay>
            <smtx:XamlDisplay Key="shadow_9" Margin="16 0 0 0">
                <Button Style="{DynamicResource MaterialDesignFloatingActionMiniButton}"
                    materialDesign:ShadowAssist.ShadowDepth="Depth4"
                    >4</Button>
            </smtx:XamlDisplay>
            <smtx:XamlDisplay Key="shadow_10" Margin="16 0 0 0">
                <Button Style="{DynamicResource MaterialDesignFloatingActionMiniButton}"
                    materialDesign:ShadowAssist.ShadowDepth="Depth5"
                    >5</Button>
            </smtx:XamlDisplay>
        </StackPanel>
        <StackPanel Orientation="Horizontal" Margin="0 32 0 0">
            <smtx:XamlDisplay Key="shadow_11">
                <materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth1" Padding="32">DEPTH 1</materialDesign:Card>
            </smtx:XamlDisplay>
            <smtx:XamlDisplay Key="shadow_12" Margin="16 0 0 0">
                <materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth2" Padding="32">DEPTH 2</materialDesign:Card>
            </smtx:XamlDisplay>
            <smtx:XamlDisplay Key="shadow_13" Margin="16 0 0 0">
                <materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth3" Padding="32">DEPTH 3</materialDesign:Card>
            </smtx:XamlDisplay>
            <smtx:XamlDisplay Key="shadow_14" Margin="16 0 0 0">
                <materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth4" Padding="32">DEPTH 4</materialDesign:Card>
            </smtx:XamlDisplay>
            <smtx:XamlDisplay Key="shadow_15" Margin="16 0 0 0">
                <materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth5" Padding="32">DEPTH 5</materialDesign:Card>
            </smtx:XamlDisplay>
        </StackPanel>
        <StackPanel Orientation="Horizontal" Margin="0 32 0 0">
            <smtx:XamlDisplay Key="shadow_16">
                <materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth3" materialDesign:ShadowAssist.ShadowEdges="Bottom,Right" Padding="32">CUSTOM CLIP</materialDesign:Card>
            </smtx:XamlDisplay>
            <smtx:XamlDisplay Key="shadow_17" Margin="16 0 0 0">
                <materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth3" materialDesign:ShadowAssist.ShadowEdges="Top" Padding="32">CUSTOM CLIP</materialDesign:Card>
            </smtx:XamlDisplay>
            <smtx:XamlDisplay Key="shadow_18" Margin="16 0 0 0">
                <materialDesign:Card materialDesign:ShadowAssist.ShadowDepth="Depth3" materialDesign:ShadowAssist.ShadowEdges="Bottom,Left" Padding="32">CUSTOM CLIP</materialDesign:Card>
            </smtx:XamlDisplay>
        </StackPanel>
    </StackPanel>
</Grid>

App.Xaml

<Application x:Class="Test_App.App"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:local="clr-namespace:Test_App"
         StartupUri="MainWindow.xaml">
<Application.Resources>
    <ResourceDictionary>
        <ResourceDictionary.MergedDictionaries>

            <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
            <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />

        </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
</Application.Resources>

Hammas
  • 1,126
  • 1
  • 12
  • 37
  • For GOD Sake !! its not duplicate ..i already tried solutions provided in other question . and that doesn't work that's why i asked here ! – Hammas May 07 '18 at 07:52
  • Then explain in which way your question is different from the duplicate one and what exactly you have already tried. "It doesn't work" is not a sufficient problem description. Post the relevant parts of your code and explain what it is supposed to do. – Clemens May 07 '18 at 07:56
  • Edited ! @Clemens – Hammas May 07 '18 at 08:10
  • And your application's project has referenced a ShowMeTheXAML assembly that contains a XamlDisplay class in a ShowMeTheXAML namespace? – Clemens May 07 '18 at 08:17
  • @Clemens updated full code ! and no nothing exist like that ! and thats the problem . in official documentation they provided this code and i just used that ! now i am getting this problem ! – Hammas May 07 '18 at 08:23
  • and i am specifically referring to MaterialDesignInXamlToolkit . That's why i mentioned it in start sir ! – Hammas May 07 '18 at 08:24

2 Answers2

10

I am the author of ShowMeTheXaml. The intent with the project was to give the demo app in MaterialDesignInXAML (MDIX) the functionality to show the corresponding XAML for the MDIX controls and styles. Unless you are wanting this same functionality in your app (very unlikely), you can remove ShowMeTheXaml from your project. As for your xaml, you can simply remove the <smtx:XamlDisplay> tags and leave the contents.

Kevin B
  • 665
  • 4
  • 11
1

ok so the problem was i was missing the REFERENCE of ShowMeTheXaml and it has to be manually installed using Nugget Package Manager and that's it :)

ShowMeTheXaml

Hammas
  • 1,126
  • 1
  • 12
  • 37