Комментарии:
Can you share the code thanks in advance
ОтветитьHalf of the stuff is skipped...so not too helpfull overall.
ОтветитьCannot implicitly convert type string to int in addemployee
ОтветитьWhy didn't you show the custom command kindly try to make the complete video and don't put the other commands video link in the reply give the source code of commands you used in this video
Ответитьwhere did this "EmployeeEntities" come from?
Ответитьcan you show code about class Command, I can not see code Command class?
ОтветитьHello, again. Could you help me please? I follow your tutorial and try to add DeleteCommand, but for some reason the DELETE button does not respond to the click. And there is no any reaction reaction to the click.
=====
<ListView ItemsSource="{Binding Records}" >
<ListView.View>
<GridView>
<GridView.Columns>
<GridViewColumn Width="100" Header="ID" DisplayMemberBinding="{Binding ArticleId}" />
<GridViewColumn Width="100" Header="TITLE" DisplayMemberBinding="{Binding Title}" />
<GridViewColumn Width="100" Header="DECRIPTION" DisplayMemberBinding="{Binding Descripton}" />
<GridViewColumn Width="100" Header="CATEGORY" DisplayMemberBinding="{Binding Category}" />
<GridViewColumn Width="100" Header="AUTHOR" DisplayMemberBinding="{Binding Author}" />
<GridViewColumn Width="100" Header="Actions">
<GridViewColumn.CellTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<Button
Command="{Binding DeleteCommand, RelativeSource={RelativeSource AncestorType={x:Type ListView}}}"
CommandParameter="{Binding SelectedRecord}"
Content="DELETE" />
</StackPanel>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
</GridView.Columns>
</GridView>
</ListView.View>
</ListView>
======
public class RecordsViewModel : ViewModelBase
private Article _selectedRecord;
public RecordsViewModel()
{
LoadData();
DeleteCommand = new MyCommand((s) => true, Delete);
}
public ICommand DeleteCommand { get; set; }
private void Delete(object obj)
{
var rec = obj as Article;
using (AppDbContext context = new AppDbContext())
{
context.News.Remove(rec);
context.SaveChanges();
}
}
private void LoadData() {
using (AppDbContext context = new AppDbContext())
{
var listRecords = context.News.ToList();
_records = new ObservableCollection<Article>(listRecords);
}
}
private ObservableCollection<Article> _records { get; set; }
public ObservableCollection<Article> Records
{
get { return _records; }
set
{
_records = value;
OnPropertyChanged("CollectionCar");
}
}
=========
class MyCommand : ICommand
{
Action<object> _execute;
Func<object, bool> _canExecute;
public event EventHandler CanExecuteChanged
{
add { CommandManager.RequerySuggested += value; }
remove { CommandManager.RequerySuggested -= value; }
}
public MyCommand(Func<object, bool> canExecute , Action<object> execute)
{
_execute = execute;
_canExecute = canExecute;
}
public bool CanExecute(object parameter)
{
// return _canExecute == null || _canExecute(parameter);
return _canExecute != null && _canExecute.Invoke(parameter);
}
public void Execute(object parameter) => _execute?.Invoke(parameter);
======
how to use sql procedures in WPF MVVM concept without using the EnityFramework
ОтветитьPardon, but where is the code of EmployeEntities class? Ist it DbContext realization?
ОтветитьThanks for this video but as a beginner can you explain the code behind your application?its so very fast for me..thank you
ОтветитьIt is not loading? I have a few records in the table.
ОтветитьSource code? this is going to fast for me
ОтветитьExcellent :) This Channel will touch million views
ОтветитьThank you
Ответитьhello sir, subtitle will be helpfull.
ОтветитьHello sir, Please how do you auto generate OnPropertyChanged ? thanks in advance.
ОтветитьThank you very much, it's very helpfull.
ОтветитьHello Sir, you are Awesome Nice work, and the same as I was looking for... Such topic like that not easy to find I hope you can keep time to time to do more video in the same context, it will be helpful. Just not make the video so quick 😁😁😁 my eyes was flying... Thank you so much and keep going
ОтветитьHelpful tutorial Thanks 🙌
ОтветитьSuper tutorial. Please do the same, only from DataGrid. 😃👍👍👍
Ответить