Click here to Skip to main content
15,906,335 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to compare string data by value and by reference Pin
Mycroft Holmes11-Jan-18 10:32
professionalMycroft Holmes11-Jan-18 10:32 
GeneralRe: How to compare string data by value and by reference Pin
OriginalGriff11-Jan-18 11:19
mveOriginalGriff11-Jan-18 11:19 
QuestionC# Windows Form Application with 86x unmanaged dll Pin
Zeyad Jalil8-Jan-18 20:33
professionalZeyad Jalil8-Jan-18 20:33 
AnswerRe: C# Windows Form Application with 86x unmanaged dll Pin
OriginalGriff8-Jan-18 21:16
mveOriginalGriff8-Jan-18 21:16 
AnswerRe: C# Windows Form Application with 86x unmanaged dll Pin
Gerry Schmitz10-Jan-18 8:23
mveGerry Schmitz10-Jan-18 8:23 
QuestionGame Pin
Member 136022178-Jan-18 10:55
Member 136022178-Jan-18 10:55 
AnswerRe: Game Pin
Pete O'Hanlon8-Jan-18 11:09
mvePete O'Hanlon8-Jan-18 11:09 
GeneralRe: Game Pin
Dave Kreskowiak8-Jan-18 11:26
mveDave Kreskowiak8-Jan-18 11:26 
AnswerRe: Game Pin
Swinkaran8-Jan-18 11:38
professionalSwinkaran8-Jan-18 11:38 
GeneralRe: Game Pin
PIEBALDconsult8-Jan-18 13:15
mvePIEBALDconsult8-Jan-18 13:15 
AnswerRe: Game Pin
Chris Quinn8-Jan-18 21:26
Chris Quinn8-Jan-18 21:26 
AnswerRe: Game Pin
V.9-Jan-18 21:55
professionalV.9-Jan-18 21:55 
QuestionQuestion About Async/Await Pin
Kevin Marois8-Jan-18 6:46
professionalKevin Marois8-Jan-18 6:46 
AnswerRe: Question About Async/Await Pin
Alex Schunk8-Jan-18 7:00
Alex Schunk8-Jan-18 7:00 
GeneralRe: Question About Async/Await Pin
Kevin Marois8-Jan-18 8:13
professionalKevin Marois8-Jan-18 8:13 
GeneralRe: Question About Async/Await Pin
Alex Schunk8-Jan-18 8:21
Alex Schunk8-Jan-18 8:21 
GeneralRe: Question About Async/Await Pin
Kevin Marois8-Jan-18 9:45
professionalKevin Marois8-Jan-18 9:45 
GeneralRe: Question About Async/Await Pin
Alex Schunk8-Jan-18 9:55
Alex Schunk8-Jan-18 9:55 
AnswerRe: Question About Async/Await Pin
Dave Kreskowiak8-Jan-18 8:39
mveDave Kreskowiak8-Jan-18 8:39 
GeneralRe: Question About Async/Await Pin
Kevin Marois8-Jan-18 9:44
professionalKevin Marois8-Jan-18 9:44 
AnswerRe: Question About Async/Await Pin
Gerry Schmitz10-Jan-18 8:34
mveGerry Schmitz10-Jan-18 8:34 
QuestionToggle button in a datatemplate with command binding using MVVM design approach Pin
Hervend7-Jan-18 16:17
Hervend7-Jan-18 16:17 
Hi everybody,

I have implemented a Icommand RowHeaderToggleButton in my MVVM application type.
My problem: whenever I click on the toggle button, nothing happens.
Could someone help me with this issue?

Best regards,

Hervend

xaml:
<datagrid.rowheadertemplate>
<datatemplate>
<togglebutton x:name="RowHeaderToggleButton" cursor="Hand"
="" command="{Binding RowHeaderToggleButtonCommand}">



c# (inside view model):

public AlarmsListViewModel(DataBase dataBase)
{
this.dataBase = dataBase;
this.alarms = new ObservableCollection<alarmviewmodel>();

foreach (Alarm alarm in this.dataBase.Alarms)
{
this.alarms.Add(new AlarmViewModel(alarm));
}

this.ListOfAlarms = CollectionViewSource.GetDefaultView(this.alarms);
if (this.ListOfAlarms == null)
throw new NullReferenceException("ListOfAlarms");

this.ListOfAlarms.CurrentChanged += new EventHandler(this.OnCollectionViewCurrentChanged);
}

#region Fields
private readonly DataBase dataBase;
private readonly ObservableCollection<alarmviewmodel> alarms;
private readonly ICollectionView ListOfAlarms;
private ICommand rowHeaderToggleButton;
#endregion //Fields

...

public ICommand RowHeaderToggleButtonCommand
{
get
{
if (this.rowHeaderToggleButton == null)
this.rowHeaderToggleButton = new RelayCommand(() => this.RowHeaderToggleButton_Click(), () => this.CanToggle());

return this.rowHeaderToggleButton;
}
}
private bool CanToggle()
{
return true;
}
private void RowHeaderToggleButton_Click()
{
DataGridRow row = this.ListOfAlarms.CurrentItem as DataGridRow;
if (row.DetailsVisibility == Visibility.Visible)
row.IsSelected = false;
else
row.IsSelected = true;
}
AnswerRe: Toggle button in a datatemplate with command binding using MVVM design approach Pin
Kenneth Haugland7-Jan-18 17:32
mvaKenneth Haugland7-Jan-18 17:32 
GeneralRe: Toggle button in a datatemplate with command binding using MVVM design approach Pin
Hervend8-Jan-18 0:04
Hervend8-Jan-18 0:04 
GeneralRe: Toggle button in a datatemplate with command binding using MVVM design approach Pin
Kenneth Haugland8-Jan-18 1:08
mvaKenneth Haugland8-Jan-18 1:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.