1

Here is a xaml-file App.xaml.

<Application x:Class="Fifteen.App"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:local="clr-namespace:Fifteen"
         StartupUri="MainWindow.xaml">
<Application.Resources>
    <Style TargetType="{x:Type local:Cell}">
        <Setter Property="Canvas.Top" Value="{Binding Top, RelativeSource={RelativeSource Self}}" />
        <Setter Property="Canvas.Left" Value="{Binding Left, RelativeSource={RelativeSource Self}}" />
        <Setter Property="Background">
            <Setter.Value>
                <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
                    <GradientStop Offset="0" Color="#F7F7F7" />
                    <GradientStop Offset="1" Color="#E3E3E3" />
                </LinearGradientBrush>
            </Setter.Value>
        </Setter>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:Cell}">
                    <Border Name="border"
                            Width="75"
                            Height="75"
                            Background="{TemplateBinding Background}"
                            BorderBrush="Silver"
                            BorderThickness="1"
                            CornerRadius="2">
                        <TextBlock Name="text"
                                   HorizontalAlignment="Center"
                                   VerticalAlignment="Center"
                                   FontSize="22"
                                   Text="{TemplateBinding Text}" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True">
                            <Setter TargetName="text" Property="Foreground" Value="Red" />
                            <Setter TargetName="border" Property="Effect">
                                <Setter.Value>
                                    <DropShadowEffect ShadowDepth="0" />
                                </Setter.Value>
                            </Setter>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="True">
                <Setter Property="Background" Value="Beige" />
                <Setter Property="Cursor" Value="Hand" />
            </DataTrigger>
        </Style.Triggers>
    </Style>
</Application.Resources>

On the line with tag I have an error

The name "Cell" does not exist in the namespace "clr-namespace:Fifteen".

I can't explain why it's generated as an error if this class is in this name space. Here:

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;

namespace Fifteen
{
    public class Cell : Control
    {
        static Cell()
        {
            DefaultStyleKeyProperty.OverrideMetadata(typeof(Cell), new 
FrameworkPropertyMetadata(typeof(Cell)));
        }
    }
}
dymanoid
  • 14,771
  • 4
  • 36
  • 64
  • https://stackoverflow.com/questions/28216096/wpf-the-name-does-not-exist-in-the-namespace – ajg Oct 17 '17 at 12:54
  • It doesn't help unfortunetely – Roman Zeleniy Oct 17 '17 at 12:59
  • Beside it I have the following – Roman Zeleniy Oct 17 '17 at 13:01
  • Error The "NotifyPropertyWeaverMsBuildTask.WeavingTask" task could not be loaded from the assembly D:\Новые пятнашки\Fifteen\Tools\NotifyPropertyWeaverMsBuildTask.dll. Could not load file or assembly 'file:///D:\Новые пятнашки\Fifteen\Tools\NotifyPropertyWeaverMsBuildTask.dll' or one of its dependencies. Не удается найти указанный файл. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. – Roman Zeleniy Oct 17 '17 at 13:02
  • Have you tried to restart your `Visual Studio`? – Iron Oct 17 '17 at 13:10

0 Answers0