Note that there are some explanatory texts on larger screens.

plurals
  1. POThe name TemplateSelector does not exist in the namespace
    primarykey
    data
    text
    <p>Hi I get this error <code>Error 1 The name "TemplateSelector" does not exist in the namespace "using:MyApps"</code> but I dont know why because when I create new project and paste the same code to him everything is working so problem is only in my old project. I also try clean or rebuild project 100 times and manually delete bin folder but still not work.</p> <pre><code>&lt;Page x:Class="MyApps.BlankPage1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:MyApps" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"&gt; </code></pre> <p>...</p> <pre><code> &lt;UserControl&gt; &lt;UserControl.Resources&gt; &lt;!-- Template for INCOMNIG messages --&gt; &lt;DataTemplate x:Key="IncomnigTemplate"&gt; &lt;Grid&gt; &lt;Grid Margin="27,0,0,0" HorizontalAlignment="Left" Background="#BFE8FF" &gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="*"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="auto"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="auto"&gt;&lt;/RowDefinition&gt; &lt;/Grid.RowDefinitions&gt; &lt;TextBlock Grid.Column="0" Grid.Row="0" Text="{Binding MessengerMessage}" HorizontalAlignment="Left" Margin="5,5,20,0" VerticalAlignment="Top" Foreground="black"&gt;&lt;/TextBlock&gt; &lt;TextBlock Grid.Column="0" Grid.Row="1" Text="{Binding MessengerTime}" HorizontalAlignment="Left" Margin="5,0,0,5" VerticalAlignment="Bottom" FontSize="9" Foreground="#908C8C"&gt;&lt;/TextBlock&gt; &lt;/Grid&gt; &lt;/Grid&gt; &lt;/DataTemplate&gt; &lt;!-- Template for OUTGOING messages --&gt; &lt;DataTemplate x:Key="OutgoinTemplate"&gt; &lt;Grid&gt; &lt;Grid Margin="27,0,0,0" HorizontalAlignment="Right" Background="Gray" &gt; &lt;Grid.ColumnDefinitions&gt; &lt;ColumnDefinition Width="*"/&gt; &lt;/Grid.ColumnDefinitions&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="auto"&gt;&lt;/RowDefinition&gt; &lt;RowDefinition Height="auto"&gt;&lt;/RowDefinition&gt; &lt;/Grid.RowDefinitions&gt; &lt;TextBlock Grid.Column="0" Grid.Row="0" Text="{Binding MessengerMessage}" HorizontalAlignment="Left" Margin="5,5,20,0" VerticalAlignment="Top" Foreground="black"&gt;&lt;/TextBlock&gt; &lt;TextBlock Grid.Column="0" Grid.Row="1" Text="{Binding MessengerTime}" HorizontalAlignment="Left" Margin="5,0,0,5" VerticalAlignment="Bottom" FontSize="9" Foreground="#908C8C"&gt;&lt;/TextBlock&gt; &lt;/Grid&gt; &lt;/Grid&gt; &lt;/DataTemplate&gt; &lt;!-- datatemplate selector --&gt; &lt;local:TemplateSelector x:Key="MessageTemplateSelector" EmptyTemplate="{x:Null}" IncomingMessageTemplate="{StaticResource IncomnigTemplate}" OutgoingMessageCaptureTemplate="{StaticResource OutgoinTemplate}"/&gt; &lt;/UserControl.Resources&gt; &lt;ListBox ItemTemplateSelector="{StaticResource MessageTemplateSelector}" x:Name="lbChoosenMessagesUsers" Grid.Column="3" FontSize="13" ItemsSource="{Binding MyDatasCurentUser}" Margin="0,0,50,0"&gt; &lt;ListBox.ItemContainerStyle&gt; &lt;Style TargetType="ListBoxItem"&gt; &lt;Setter Property="IsEnabled" Value="False"/&gt; &lt;/Style&gt; &lt;/ListBox.ItemContainerStyle&gt; &lt;/ListBox&gt; &lt;/UserControl&gt;... </code></pre> <p>Class TeplateSelector inside project:</p> <pre><code>public class TemplateSelector : DataTemplateSelector { public DataTemplate IncomingMessageTemplate { get; set; } public DataTemplate OutgoingMessageCaptureTemplate { get; set; } public DataTemplate EmptyTemplate { get; set; } public new DataTemplate SelectTemplate(object item, DependencyObject container) { var x = item as Message; if (x != null) { return null; } return EmptyTemplate; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload