Проблема при создании дизайна для программы на C# - WPF (NET.Framework)
При запуске отладки Visual Studio показвает такую ошибку:
System.Windows.Markup.XamlParseException: ""Задание свойства "System.Windows.FrameworkElement.Style" вызвало исключение.": номер строки "270" и позиция в строке "42"."
Внутреннее исключение InvalidOperationException: TargetType "TextBlock" не соответствует типу элемента "ToolTip".
Код (XAML):
<Window x:Class="Debris_Cleaner.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:Debris_Cleaner"
mc:Ignorable="d"
Title="MainWindow"
Height="500"
Width="900"
ResizeMode="NoResize"
Topmost="True"
WindowStyle="None"
WindowStartupLocation="CenterScreen">
<Window.Resources>
<!-- Стиль шаблона переключение кнопок -->
<ImageBrush x:Key="tb_mouse_over"
ImageSource="Assets/mouse_over_btn.png"/>
<!-- Стиль текста -->
<Style x:Key="font_style" TargetType="TextBlock">
<Setter Property="FontFamily"
Value="Fonts/Verdana.ttf #Verdana"/>
<Setter Property="VerticalAlignment"
Value="Center"/>
<Setter Property="HorizontalAlignment"
Value="Left"/>
<Setter Property="Foreground"
Value="White"/>
<Setter Property="FontSize"
Value="20"/>
</Style>
<!-- Стиль шаблона всплывающей подсказки -->
<Style TargetType="ToolTip" x:Key="tt_style">
<Setter Property="Placement" Value="Right"/>
<Setter Property="Height" Value="40"/>
<Setter Property="Width" Value="100"/>
<Setter Property="Margin" Value="20,0,0,0"/>
<Setter Property="Background" Value="#4A5668"/>
<Setter Property="BorderBrush" Value="Transparent"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontFamily" Value="Fonts/Verdana.ttf #Verdana"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="PlacementRectangle" Value="60,0,0,0"/>
<Setter Property="HorizontalOffset" Value="15"/>
<Setter Property="VerticalOffset" Value="6"/>
<Setter Property="HasDropShadow" Value="True"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
<Style x:Key="tb_style" TargetType="{x:Type ToggleButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Border x:Name="border"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
SnapsToDevicePixels="True">
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background"
TargetName="border"
Value="{StaticResource tb_mouse_over}"/>
<Setter Property="Background"
TargetName="border"
Value="{StaticResource tb_mouse_over}"/>
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background"
TargetName="border"
Value="{StaticResource tb_mouse_over}"/>
<Setter Property="Background"
TargetName="border"
Value="{StaticResource tb_mouse_over}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<!--// Цвет фона //-->
<Grid Background="Black">
<!--// Панель навигации //-->
<Grid x:Name="nav_pnl"
HorizontalAlignment="Left"
Width="65"
Background="#2E333A">
<StackPanel x:Name="st_pnl">
<!-- Cетка для кнопки переключения меню -->
<Grid Height="90">
<!-- Заголовок текста меню -->
<TextBlock Grid.Row="1"
Grid.Column="0"
Margin="73,-20,0,0"
Text="М Е Н Ю"
Foreground="White"
FontSize="22"
Background="Transparent"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Style="{StaticResource font_style}">
<!-- Эффект тени -->
<TextBlock.Effect>
<DropShadowEffect BlurRadius="10"
ShadowDepth="1"
Direction="90"
Color="White"/>
</TextBlock.Effect>
</TextBlock>
<!-- Переключение кнопок -->
<ToggleButton x:Name="Tg_Btn"
Grid.Column="0"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Margin="18,-20,0,0"
Height="30"
Width="30"
BorderThickness="0"
Style="{StaticResource tb_style}">
<!-- фоновое изображение кнопки переключения по умолчанию -->
<ToggleButton.Background>
<ImageBrush ImageSource="Assets/menu_btn.png"
Stretch="Fill"/>
</ToggleButton.Background>
<!-- проверка переключение кнопок -->
<ToggleButton.Triggers>
<EventTrigger RoutedEvent="ToggleButton.Unchecked">
<BeginStoryboard>
<Storyboard x:Name="HideStackPanel">
<DoubleAnimation
Storyboard.TargetName="nav_pnl"
Storyboard.TargetProperty="Width"
BeginTime="0:0:0"
From="230" To="65"
Duration="0:0:0.2">
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="ToggleButton.Checked">
<BeginStoryboard>
<Storyboard x:Name="ShowStackPanel">
<DoubleAnimation
Storyboard.TargetName="nav_pnl"
Storyboard.TargetProperty="Width"
BeginTime="0:0:0"
From="65" To="230"
Duration="0:0:0.3">
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ToggleButton.Triggers>
</ToggleButton>
</Grid>
<!-- Просмотр списка меню -->
<ListView x:Name="LV"
Background="Transparent"
BorderBrush="Transparent"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<!-- Главная -->
<ListViewItem HorizontalAlignment="Left"
Margin="0,0,0,15"
>
<StackPanel Orientation="Horizontal"
Width="230">
<Image Source="Assets/home_btn.png"
Stretch="None"
Margin="12,0,0,0"/>
<TextBlock Text="Главная"
Margin="25,0,0,0"
Style="{StaticResource font_style}"/>
</StackPanel>
<!-- Всплывающая подсказка -->
<ListViewItem.ToolTip>
<ToolTip x:Name="tt_home"
Content="Главная"
Style="{StaticResource font_style}"/>
</ListViewItem.ToolTip>
</ListViewItem>
<!-- Инструменты -->
<ListViewItem HorizontalAlignment="Left"
Margin="0,0,0,15"
>
<StackPanel Orientation="Horizontal"
Width="230">
<Image Source="Assets/instruments_btn.png"
Stretch="None"
Margin="12,0,0,0"/>
<TextBlock Text="Инструменты"
Margin="25,0,0,0"
Style="{StaticResource font_style}"/>
</StackPanel>
<!-- Всплывающая подсказка -->
<ListViewItem.ToolTip>
<ToolTip x:Name="tt_instruments"
Content="Инструменты"
Style="{StaticResource font_style}"/>
</ListViewItem.ToolTip>
</ListViewItem>
<!-- Настройки -->
<ListViewItem HorizontalAlignment="Left"
Margin="0,0,0,15"
>
<StackPanel Orientation="Horizontal"
Width="230">
<Image Source="Assets/settings_btn.png"
Stretch="None"
Margin="12,0,0,0"/>
<TextBlock Text="Настройки"
Margin="25,0,0,0"
Style="{StaticResource font_style}"/>
</StackPanel>
<!-- Всплывающая подсказка -->
<ListViewItem.ToolTip>
<ToolTip x:Name="tt_settings"
Content="Настройки"
Style="{StaticResource font_style}"/>
</ListViewItem.ToolTip>
</ListViewItem>
</ListView>
</StackPanel>
</Grid>
</Grid>
</Grid>
Источник: Stack Overflow на русском