Cześć wam,
mam taki problem iż za bardzo nie mogę wpaść na to jak zbindować Command do komponentu ToDoTask, w którym znajduje się button który będzie miał na celu za oznaczenie taska jako wykonany. Z góry dzięki wielkie za pomoc :D
<Grid Background="#FF333333">
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<local:BackButton Grid.Row="0"/>
<Label FontWeight="Bold" HorizontalAlignment="Center" Content="TO DO TASKS" Grid.Row="1" Foreground="White" FontFamily="Arial Blac" FontSize="36"/>
<ScrollViewer Grid.Row="2">
<ItemsControl ItemsSource="{Binding ToDoTasksList}" Margin="10">
<ItemsControl.ItemTemplate>
<DataTemplate>
<local:ToDoTask/> // Tutaj chciałbym przekazać odpowiedni Command jak to jest w przypadku add new task buttona "Command="{Binding AddNewTaskCommand}""
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="3*"/>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Command="{Binding AddNewTaskCommand}" Style="{StaticResource TasksToDoAddTaskBtnStyles}" >ADD NEW TASK</Button>
<TextBox Text="{Binding NewWorkTaskDescription, Mode=TwoWay}" Grid.Column="1" Style="{StaticResource TasksToDoTextBoxStyles}"/>
</Grid>
</Grid>
ToDoTask - Component
<UserControl x:Class="ToDoApp.ToDoTask"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:ToDoApp"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid Style="{StaticResource GridTaskContainerStyle}">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Border Style="{StaticResource DefaultTaskBorderStyle}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="60"/>
</Grid.ColumnDefinitions>
<Border Grid.Column="1" BorderThickness="1,0,0,0" CornerRadius="0" Style="{StaticResource DefaultTaskBorderStyle}"/>
<Border Grid.Column="2" BorderThickness="1,0,0,0" CornerRadius="0" Style="{StaticResource DefaultTaskBorderStyle}"/>
<TextBlock Grid.Column="0" Style="{StaticResource DefaultTaskTextBlockStyle}" Text="{Binding Description}"/>
<TextBlock Grid.Column="1" Style="{StaticResource DefaultTaskTextBlockStyle}" Text="{Binding CreationDate}"/>
<TextBlock Grid.Column="2" Style="{StaticResource DefaultTaskTextBlockStyle}" Text="{Binding CategoryType}"/>
<Button Grid.Column="3" Style="{StaticResource DefaultTaskButtonStyle}" Background="#FF64CA37">DONE</Button>
<Button Grid.Column="4" Style="{StaticResource DefaultTaskButtonStyle}" Background="#FFE4563F">DELETE</Button>
</Grid>
</Border>
</Grid>
</UserControl>