Taskboard with ItemTemplate definition, getting error "Both 'ContentTemplate' and 'ContentTemplateSelector' are set"

1 Answer 81 Views
TaskBoard
Mohamad
Top achievements
Rank 1
Mohamad asked on 13 Dec 2022, 01:56 AM
Hi, 
Using Telerik.UI.for.Wpf.NetCore.Xaml  (2022.3.912).
I'm getting an error for the taskboard the first time it loads
Both 'ContentTemplate' and 'ContentTemplateSelector' are set;  'ContentTemplateSelector' will be ignored. RadTaskBoardItem:'RadTaskBoardItem' (Name='')
this error as many as the Item task that appears.

Then when I exit and return to the taskboar page, another error appears:
Cannot find source: RelativeSource FindAncestor, AncestorType='Telerik.Windows.Controls.RadTaskBoard', AncestorLevel='1'

        <telerik:RadTaskBoard x:Name="RadTaskBoard01"  Grid.Row="3" 
                              ItemsSource="{Binding TaskboardCollView}" 
                              GroupMemberPath="State"
                              Background="{StaticResource StripeColor}" 
                              AutoGenerateColumns="False">
            <telerik:RadTaskBoard.DragDropBehavior>
                <localservice:CustomTaskBoardDragDropBehavior/>
            </telerik:RadTaskBoard.DragDropBehavior>
            <telerik:RadTaskBoard.Columns>
                <telerik:TaskBoardColumn GroupName="NEW" Header="Red"  />
                <telerik:TaskBoardColumn GroupName="INPROGRESS" Header="Yellow" />
                <telerik:TaskBoardColumn GroupName="REVIEWED" Header="Gray" />
                <telerik:TaskBoardColumn GroupName="DONE" Header="ForestGreen" />
            </telerik:RadTaskBoard.Columns>
            <telerik:RadTaskBoard.ColumnHeaderTemplate >
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions >
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Border  Width="17" Grid.Column="0" Background ="{Binding Header}"  BorderThickness="1" BorderBrush="Black" CornerRadius="10" ></Border>
                        <TextBlock Grid.Column="1" Text="{Binding GroupName}"  HorizontalAlignment="Left"  />
                        <TextBlock Grid.Column="2" Margin="10 ,0 ,10, 0" Text="{Binding Items.Count}" HorizontalAlignment="Right" />
                    </Grid>
                </DataTemplate>
            </telerik:RadTaskBoard.ColumnHeaderTemplate>
            <telerik:RadTaskBoard.ItemTemplate>
                <DataTemplate>
                    <Grid >
                        <Grid.ColumnDefinitions >
                            <ColumnDefinition Width="5"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions >
                            <RowDefinition/>
                            <RowDefinition Height="25"/>
                        </Grid.RowDefinitions>
                        <Grid Grid.Row="0" Grid.RowSpan="2" Grid.Column ="0" 
                              Background="{Binding CategoryName, Converter={StaticResource CategoryToColour}}">
                        </Grid>
                        <StackPanel  Grid.Row="0"  Grid.Column ="1" >
                            <TextBlock Text="{Binding Parenttitle}"  Margin="15,0,5,0"   Foreground="{StaticResource StripeColor}"  FontSize="16" TextWrapping="Wrap"  />
                            <StackPanel Visibility="{Binding Isparent, Converter={StaticResource BoolToVisible}}">
                                <TextBlock Text="Have Sub Task"
                                           HorizontalAlignment="Right"
                                           Margin="0,0,5,0"
                                           Foreground="Red"
                                           FontWeight="Bold"
                                           FontStyle ="Italic" 
                                           FontSize="12" />
                            </StackPanel>
                            <StackPanel Visibility="{Binding Title, Converter={StaticResource EmptyToVisible }}">
                                <TextBlock Text="{Binding Title}"
                                           Margin="15,0,5,0"
                                           Foreground="Brown"
                                           TextWrapping="WrapWithOverflow"
                                           FontSize="14" />
                            </StackPanel>
                            <TextBlock Text="{Binding Description}"
                                       Margin="15,0,5,0"
                                       TextWrapping="Wrap"
                                       FontSize="14" />
                        </StackPanel>

                        <TextBlock Text="{Binding Assignee}"  Grid.Row="1"   Grid.Column ="1" Margin="15,0,15,0" Foreground="ForestGreen"      
                                   FontSize="16" FontStyle="Italic"  HorizontalAlignment="Right" VerticalAlignment="Bottom" />
                    </Grid>
                </DataTemplate>
            </telerik:RadTaskBoard.ItemTemplate>
        </telerik:RadTaskBoard>

1 Answer, 1 is accepted

Sort by
0
Stenly
Telerik team
answered on 13 Dec 2022, 12:41 PM

Hello Mohamad,

This message is shown due to the fact that the RadTaskBoard has an ItemTemplateSelector set by default through its style. In order to remove this message when setting the ItemTemplate, you can set the ItemTemplateSelector property to null, since only one of those properties can be applied at a time:

<telerik:RadTaskBoard x:Name="RadTaskBoard01"  Grid.Row="3" 
                              ItemsSource="{Binding TaskboardCollView}" 
                              GroupMemberPath="State"
                              Background="{StaticResource StripeColor}" 
                              AutoGenerateColumns="False"
			      ItemTemplateSelector="{x:Null}">

Regarding the second inquiry, I was not able to reproduce it on my end. Would it be possible to give the attached sample project a try and let me know if I am missing something?

Regards,
Stenly
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
TaskBoard
Asked by
Mohamad
Top achievements
Rank 1
Answers by
Stenly
Telerik team
Share this question
or