Cleaning up automatically created View Model - wpf

Currently I'm binding my View Control straight to my Model.
But I'd like to :
a) provide more events/properties than the ones exposed in the Model.
b) provide properties based on Model data that are more suited for the View
And so to do this, I've decided to introduce a layer in between, which I'm calling the ViewModel(not sure if this is the correct use for the term ViewModel)
The work of the ViewModel in my scenario is to subscribe to all the events exposed by the Model and use those events to modify dependency properties in the ViewModel.
I've done this as follows.
<ItemsControl ItemsSource="{Binding Items}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<local:View DataContext="{Binding Converter={StaticResource modelToViewModel}}"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
Here, Items is a collection of 'Model' type data, which I convert to 'ViewModel' types that the view can then bind to.
public class Model : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
int m_age;
public int Age
{
get { return m_age; }
set { m_age = value; NotifyPropertyChanged("Age"); }
}
void NotifyPropertyChanged(string _property)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(_property));
}
}
}
public class ViewModel : DependencyObject
{
public Model Model { get; private set; }
public ViewModel(Model _model)
{
Model = _model;
Model.PropertyChanged += OnModelPropertyChanged;
}
void OnModelPropertyChanged(object sender, PropertyChangedEventArgs e)
{
// .. here - I would modify this ViewModels dependency properties
}
}
public class ModelToViewModel : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return new ViewModel(value as Model);
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
The problem I have now, is how to dispose of the ViewModel so it can unregister the property changed events in ViewModel. I'm thinking the best place to do this would be in the unloaded event of the View, but would like your thoughts.
public partial class View : UserControl
{
public View()
{
Unloaded += OnUnloaded;
InitializeComponent();
}
void OnUnloaded(object sender, RoutedEventArgs e)
{
if (DataContext != null)
{
(DataContext as ViewModel).Dispose();
}
}
}
Edit : I guess I would also need to Call dispose when the datacontext of the View changes, which would occur if an Item in the Items list was replaced.

Well you could implement IDisposible.
public class ViewModel : DependencyObject, IDisposable
{
public Model Model { get; private set; }
public ViewModel(Model _model)
{
Model = _model;
Model.PropertyChanged += OnModelPropertyChanged;
}
~ViewModel()
{
Dispose(false);
}
void OnModelPropertyChanged(object sender, PropertyChangedEventArgs e)
{
// .. here - I would modify this ViewModels dependency properties
}
public void Dispose()
{
Dispose(true);
GC.SupressFinalize();
}
protected virtual void Dispose(bool disposing)
{
if (disposing)
{
if (Model != null)
Model.PropertyChanged -= OnModelPropertyChanged;
}
}
}
If you're wondering about the implementation. You can find some information here. You must also unassign the call back in the view.
public partial class View : UserControl
{
public View()
{
Unloaded += OnUnloaded;
InitializeComponent();
}
void OnUnloaded(object sender, RoutedEventArgs e)
{
if (DataContext != null)
{
(DataContext as ViewModel).Dispose();
}
Unloaded -= OnUnloaded; // <---
}
}

Related

Handle an event that is inside user control in list view

I have a list of user control and each user control have two buttons, and when I click on them, something must happen, but I want to handle this event not inside the user control, I want to handle the events inside the main page
So, How can I catch the events that fired by the selected item user control of list view?
user control code behind:
public sealed partial class TestingUerControl : UserControl
{
public TestingUerControl()
{
this.InitializeComponent();
}
public event EventHandler FirstButtonEvent;
public event EventHandler SecondButtonEvent;
private void firstButton_Click(object sender, RoutedEventArgs e)
{
//Some stuff of code
FirstButtonEvent?.Invoke(this, new EventArgs());
}
private void secondButton_Click(object sender, RoutedEventArgs e)
{
//Some stuff of code
SecondButtonEvent?.Invoke(this, new EventArgs());
}
}
main page xaml markup:
<ListView x:Name="listUserControl"
Width="100"
Header="400">
<ListView.ItemTemplate>
<DataTemplate x:DataType="model:MyModel">
<userControl:TestingUerControl/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
I used this statement:
((TestingUerControl)listUserControl.SelectedItem).FirstButtonEvent += OnFirstButtonEvent;
but this doesn't work I can cast the SelectedItem to MyModel class only
So How can I reach to "FirstButtonEvent" and "SecondButtonEvent" of selected user control of list view
The way with commands and MVVM is preferable, but you can also work with custom RoutedEvent instead of Event:
public sealed partial class TestingUerControl : UserControl
{
public TestingUerControl()
{
this.InitializeComponent();
}
public static readonly RoutedEvent FirstButtonEvent = EventManager.RegisterRoutedEvent(
nameof(FirstButton), RoutingStrategy.Bubble, typeof(RoutedEventHandler), typeof(TestingUerControl));
public event RoutedEventHandler FirstButton
{
add { AddHandler(FirstButtonEvent, value); }
remove { RemoveHandler(FirstButtonEvent, value); }
}
private void firstButton_Click(object sender, RoutedEventArgs e)
{
//Some stuff of code
RaiseEvent(new RoutedEventArgs(TestingUerControl.FirstButtonEvent));
}
private void secondButton_Click(object sender, RoutedEventArgs e)
{
//See first btn
}
}
and then in XAML just assign an event handler:
<ListView x:Name="listUserControl" Width="100" Header="400">
<ListView.ItemTemplate>
<DataTemplate x:DataType="model:MyModel">
<userControl:TestingUerControl FirstButton="OnFirstButton_Click"/>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
Use MVVM:
public class TestCommand : ICommand
{
Action<object> _execute;
Func<object, bool> _canExecute;
public TestCommand(Action<object> execute)
: this(execute, DefaultCanExecute)
{
}
public TestCommand(Action<object> execute, Func<object, bool> canExecute)
{
if (execute == null)
{
throw new ArgumentNullException("execute");
}
if (canExecute == null)
{
throw new ArgumentNullException("canExecute");
}
this._execute = execute;
this._canExecute = canExecute;
}
public event EventHandler CanExecuteChanged
{
add
{
CommandManager.RequerySuggested += value;
}
remove
{
CommandManager.RequerySuggested -= value;
}
}
public bool CanExecute(object parameter)
{
if (_canExecute != null)
{
return _canExecute(parameter);
}
else
{
return false;
}
}
public void Execute(object parameter)
{
_execute(parameter);
}
private static bool DefaultCanExecute(object parameter)
{
return true;
}
}
public class MyModel
{
public MyModel()
{
FirstButtonCmd = new TestCommand(OnFirstButtonCmd);
SecondButtonCmd = new TestCommand(OnSecondButtonCmd);
}
public ICommand FirstButtonCmd{get;set;}
public ICommand SecondButtonCmd{get;set;}
private void OnFirstButtonCmd()
{
//click first button
}
private void OnSecondButtonCmd()
{
//click second button
}
}
TestingUerControl.xaml
<Button Click={Binding FirstButtonCmd}></Button>
<Button Click={Binding SecondButtonCmd}></Button>
TestingUerControl.xaml.cs
public sealed partial class TestingUerControl : UserControl
{
public TestingUerControl()
{
this.InitializeComponent();
}
}

WPF: bind property from MainWindow.xaml cause an error

So I have this view model:
public class WiresharkFiles : INotifyPropertyChanged
{
public ObservableCollection<WiresharkFile> List { get; set; }
public event PropertyChangedEventHandler PropertyChanged;
private bool _inUse;
private int _packets;
private bool _hasItems;
public WiresharkFiles()
{
List = new ObservableCollection<WiresharkFile>();
HasItems = false;
List.CollectionChanged += List_CollectionChanged;
}
private void List_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
{
HasItems = List.Count > 0;
}
public bool InUse
{
get { return _inUse; }
set
{
_inUse = value;
NotifyPropertyChanged("InUse");
}
}
public int Packets
{
get { return _packets; }
set
{
_packets = value;
NotifyPropertyChanged("Packets");
}
}
public bool HasItems
{
get { return _hasItems; }
set
{
_hasItems = value;
NotifyPropertyChanged("HasItems");
}
}
private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
MainWindow.xaml
private WiresharkFiles caps;
public MainWindow()
{
InitializeComponent();
caps = new WiresharkFiles();
}
Window.Resources
<Window.Resources>
<Convertors:CollectionHasItemsConverter x:Key="CollectionHasItemsConverter"/>
</Window.Resources>
Converter
public class CollectionHasItemsConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return (bool)value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
And base of my collection item (empty or not) i want to enable/disable my Button:
<Button Name="btnDeleteAll"
Click="btnDeleteAll_Click"
IsEnabled="{Binding Path=(caps.HasItems),Converter={StaticResource CollectionHasItemsConverter}}">
And i got this error:
XamlParseException: Type reference cannot find type named
'{http://schemas.microsoft.com/winfx/2006/xaml/presentation}caps'.
I don't see where you're associating your DataContext with the caps property.
Make sure you have a public property because the WPF engine isn't running from within your class and won't be able to access the private WiresharkFiles caps; variable. Try the following:
private WiresharkFiles caps;
public WiresharkFiles Files { get { return caps; } }
with a corresponding
public MainWindow()
{
InitializeComponent();
caps = new WiresharkFiles();
DataContext = Files;
}
Your XAML will then bind to Files as follows
IsEnabled="{Binding Path=HasItems}"
Update You'll need to have a look at implementing and binding to commands for the button which will make it a lot better. Look at this article for info on implementing and dealing with commands.
caps is a private variable:
private WiresharkFiles caps;
In order to bind, it would have to be a public property:
public WiresharkFiles caps {get;set;}
You would also have to set the datacontext of the window to itself. Something like:
this.DataContext = this;
or
In your window tag put:
DataContext="{Binding RelativeSource={RelativeSource Self}}"
I don't see how this relates to your initial question but you can use dot notation in binding.
You can bind:
{Binding AnObservableCollection.Count}
And you can compare that to 0 in a datatrigger. With a button and a bound command if you want to disable it then I'd use the canexecute of icommand and return false if you have no entries or whatever your logic is.

Bind to a property and Element value - WPF binding

I have a checkbox which is binded to a object's property "IsValidCustomer" and I have a listview that holds some customers.
Whenever My user selects any Customer in the list, I want the Checkbox Checked property to set to False that means my "IsValidCustomer" property also will set to False automatically. Is there any way of achieving this using WPF bindings?
Any help in this regard would be highly appriciated.
Regards
-Srikanth
First make sure that your view's Datacontext is set to a viewmodel that implements the INotifyPropertyChanged interface then add a SelectedCustomer property that will hold the selected Customer from the ListView,
Each time the SelectedCustomer is set, check its value and set the IsValidCustomer property
here the full code :
the View model
public class Customer
{
public String Name { get; set; }
public String Id { get; set; }
}
public partial class MainWindow : Window, INotifyPropertyChanged
{
private Customer _selectedCustomer;
public Customer SelectedCustomer
{
get
{
return _selectedCustomer;
}
set
{
if (_selectedCustomer == value)
{
return;
}
_selectedCustomer = value;
OnPropertyChanged();
IsValidCustomer = (_selectedCustomer == null);
}
}
private ObservableCollection<Customer> _listCustomers;
public ObservableCollection<Customer> ListCustomers
{
get
{
return _listCustomers;
}
set
{
if (_listCustomers == value)
{
return;
}
_listCustomers = value;
OnPropertyChanged();
}
}
private bool _isValidCustomer = false;
public bool IsValidCustomer
{
get
{
return _isValidCustomer;
}
set
{
if (_isValidCustomer == value)
{
return;
}
_isValidCustomer = value;
OnPropertyChanged();
}
}
public MainWindow()
{
InitializeComponent();
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
}
}
and the view
<StackPanel>
<CheckBox Content="IsValidCustomer" IsChecked="{Binding IsValidCustomer,Mode=TwoWay}"></CheckBox>
<ListView ItemsSource="{Binding ListCustomers}" SelectedItem="{Binding SelectedCustomer,Mode=TwoWay}"></ListView>
</StackPanel>
I am sure you have something like this in your model :
private bool _IsValidCustomer;
public bool IsValidCustomer
{
get { return _IsValidCustomer; }
set
{
_IsValidCustomer= value;
PropertyChanged(this, new PropertyChangedEventArgs("IsValidCustomer"));
}
}
Set the Binding for that bool property.
<Style TargetType="ListViewItem">
<Setter Property="IsSelected" Value="{Binding IsValidCustomer, Converter={StaticResource InverseBooleanConverter}}"/>
</Style>
Your CheckBox will be bound to this also :
<CheckBox IsChecked="{Binding IsValidCustomer, Mode=TwoWay}"/>
So, i assume you start with that IsValidCustomer set to true. And on selecting each row, you want to set it to false.
You will need an inverse boolean converter for this:
public class InverseBooleanConverter: IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
if (targetType != typeof(bool))
throw new InvalidOperationException("The target must be a boolean");
return !(bool)value;
}
public object ConvertBack(object value, Type targetType, object parameter,
System.Globalization.CultureInfo culture)
{
throw new NotSupportedException();
}
#endregion
}

Notification of DataGrid when Collection inside Collection changes

Since hours I am working on a very hard problem:
How is a DataGrid that is bound to an ObservableCollection correctly updated when another ObservableCollection that is inside the ObservableCollection the DataGrid is bound to changes ?
So far the DataGrid onnly refreshes when i click on the corresponding cell.
I have prepared a complete source code example to illustrate the following (very simple) situation:
There is a ViewModel that holds a List. This List is an ObservableCollection and hold two things: An integer and another List (again an ObservableCollection) that holds four integers.
Then there is a DataGrid that has two columns. One column for the integer number and one column for the list of integers.
This little application has buttons to modify the integers in the nested list i.e. adding +1 to one of the four integers.
The GOAL is that the modification of the nested list is getting reflected by the DataGrid.
The PROBLEM so far is, that this only happens on a with an external trigger (e.g. a click on the corresponding cell, or a click on one column header that sorts a column etc.)
So here is the complete code:
This is the ViewModel code that the DataGrid is bound to:
public class ViewModel: INotifyPropertyChanged {
private Items items;
public Items Items {
get { return items; }
set {
items = value;
firePropertyChanged("Items");
}
}
public ViewModel() {
Items = new Items();
}
private void firePropertyChanged(string property) {
if (PropertyChanged != null) {
PropertyChanged(this, new PropertyChangedEventArgs(property));
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
public class Items: ObservableCollection<Item> {
public Items()
: base() {
this.CollectionChanged += new NotifyCollectionChangedEventHandler(OnCollectionChanged);
}
private void OnCollectionChanged(object o, NotifyCollectionChangedEventArgs e) {
if (e.NewItems != null) {
foreach (Object item in e.NewItems) {
(item as INotifyPropertyChanged).PropertyChanged += new PropertyChangedEventHandler(item_PropertyChanged);
}
}
if (e.OldItems != null) {
foreach (Object item in e.OldItems) {
(item as INotifyPropertyChanged).PropertyChanged -= new PropertyChangedEventHandler(item_PropertyChanged);
}
}
}
void item_PropertyChanged(object sender, PropertyChangedEventArgs e) {
NotifyCollectionChangedEventArgs a = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset);
OnCollectionChanged(a);
}
}
public class List: ObservableCollection<NumberItem> {
public List()
: base() {
this.CollectionChanged += new NotifyCollectionChangedEventHandler(OnCollectionChanged);
}
private void OnCollectionChanged(object o, NotifyCollectionChangedEventArgs e) {
if (e.NewItems != null) {
foreach (Object item in e.NewItems) {
(item as INotifyPropertyChanged).PropertyChanged += new PropertyChangedEventHandler(item_PropertyChanged);
}
}
if (e.OldItems != null) {
foreach (Object item in e.OldItems) {
(item as INotifyPropertyChanged).PropertyChanged -= new PropertyChangedEventHandler(item_PropertyChanged);
}
}
}
void item_PropertyChanged(object sender, PropertyChangedEventArgs e) {
NotifyCollectionChangedEventArgs a = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset);
OnCollectionChanged(a);
}
}
public class NumberItem : INotifyPropertyChanged {
private int number;
public int Number {
get { return number; }
set {
number = value;
firePropertyChanged("Number");
}
}
public NumberItem(int i) {
Number = i;
}
private void firePropertyChanged(string property) {
if (PropertyChanged != null) {
PropertyChanged(this, new PropertyChangedEventArgs(property));
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
public class Item : INotifyPropertyChanged {
private List list;
public List List {
get { return list; }
set {
list = value;
firePropertyChanged("List");
}
}
private int numberOne;
public int NumberOne {
get { return numberOne; }
set {
numberOne = value;
firePropertyChanged("NumberOne");
}
}
private void firePropertyChanged(string property) {
if (PropertyChanged != null) {
PropertyChanged(this, new PropertyChangedEventArgs(property));
}
}
public event PropertyChangedEventHandler PropertyChanged;
}
/// <summary>
/// This converter simply transforms the list of integers into a string.
/// </summary>
public class Converter : IValueConverter {
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
List l = (List)value;
string s = "";
return s + l[0].Number + " " + l[1].Number + " " + l[2].Number + " " + l[3].Number;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
return null;
}
}
The code of the buttons that manipulate the integers of the nested list is the following:
private void plus1L(object sender, RoutedEventArgs e) {
vm.Items[0].List[0].Number += 1;
}
And finally this is the XAML where the DataGrid is getting bound:
<sdk:DataGrid x:Name="dg" Margin="17,139,21,0" ItemsSource="{Binding Items}" AutoGenerateColumns="False" VerticalAlignment="Top" Height="164" d:LayoutOverrides="Width, HorizontalMargin">
<sdk:DataGrid.Columns>
<sdk:DataGridTextColumn x:Name="A" Header="A" Binding="{Binding NumberOne}"/>
<sdk:DataGridTextColumn x:Name="List" Header="List" Binding="{Binding List, Converter={StaticResource Converter}}"/>
</sdk:DataGrid.Columns>
</sdk:DataGrid>*emphasized text*
I already told you that you just need to fire change events for the List property when you change anything about it, it's not that hard...
Edit: In the handler you change the list in some way and you do nothing.
private void plus1L(object sender, RoutedEventArgs e)
{
vm.Items[0].List[0].Number += 1;
vm.Items[0].OnPropertyChanged("List"); // This is needed if you bind to List.
}
To be even more explicit about this: The binding does not care about anything other than the property path you bind to. Everything that happens inside the bound property is unknown to it, so you need to forward internal changes.
Why do people insist on creating classes which inherit from ObservableCollection<SomeObject>? Do they think something is wrong with using an ObservableCollection<Item> as a data type and using the built-in change notification???
Anyways, do this:
public class SomeViewModel : INotifyPropertyChanged
{
public ObservableCollection<MyItem> OuterCollection { get; set; }
}
public class MyItem : INotifyPropertyChanged
{
public int SomeInt { get; set; }
public ObservableCollection<int> InnerCollection { get; set; }
}
Your XAML can look like normal, however if you change a value in the InnerCollection, WPF does not know about it because an ObservableCollection is supposed to monitor the changes to a collection, not the changes to items in the collection.
To update the UI, you'll need to raise a PropertyChange notification for the InnerCollection.
myItem.InnerCollection[0]++;
myItem.RaisePropertyChanged("InnerCollection");
If the InnerCollection contains objects which implement INotifyPropertyChanged, you can subscribe to their PropertyChanged events to raise the PropertyChanged event for InnerCollection when one of the items changes.
void SomeConstructor()
{
InnerCollection = new ObservableCollection<SomeItem>();
InnerCollection.CollectionChanged += InnerCollection_CollectionChanged;
}
void InnerCollection_CollectionChanged(object sender, CollectionChangedEventArgs e)
{
if (e.NewItems != null)
for each (SomeItem item in e.NewItems)
item.PropertyChanged += SomeItem_PropertyChanged;
if (e.OldItems!= null)
for each (SomeItem item in e.OldItems)
item.PropertyChanged -= SomeItem_PropertyChanged;
}
void SomeItem_PropertyChanged(object sender, PropertyChangedEventArgs e)
{
RaisePropertyChanged("InnerCollection");
}

What's wrong with my binding?

I'm working on an application using a TCP protocol.
I want to show the different statuses of the communication in different colors (connect = green, disconnect = red)
I defined an enum:
public enum ComunicationStateTypeEnum
{
COMUNICATION_CONNECTED,
COMUNICATION_DISCONNECTED
};
I defined a conversion class:
namespace Conversion
{
[ValueConversion(typeof(ComunicationStateTypeEnum), typeof(Brushes))]
public class ComStatusToColor : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
ComunicationStateTypeEnum state = (ComunicationStateTypeEnum)value;
if (state == ComunicationStateTypeEnum.COMUNICATION_CONNECTED)
return Brushes.Green;
return Brushes.Red;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return null;
}
}
}
In Xaml I defined an ellipse:
<Ellipse Name="ComEllipse" Height="25" Width="30" Fill ="{Binding Path=eCommStatus, Converter={StaticResource ComStatusToColor}}" Stroke="Black" DockPanel.Dock="Left"/>
also in Xaml I defined:
xmlns:ConversionNamespace="clr-namespace:Conversion"
<Window.Resources>
<ConversionNamespace:ComStatusToColor x:Key="ComStatusToColor"/>
</Window.Resources>
I want to bind to an existing object, therefore I initiated:
ComEllipse.DataContext = SystemLogic.GetInstance();
(SystemLogic is a singleton)
and in SystemLogic I defined:
public class SystemLogic
{
public ComunicationStateTypeEnum eCommStatus { get; set; }
...
}
eCommStatus is initiated to COMUNICATION_DISCONNECTED in the constructor and the ellipse turns red, and still when eCommStatus member changes to COMUNICATION_CONNECTED , the ellipse doesn't change its color
What's wrong?
Gil
You need to implement INotifyPropertyChanged interface in your SystemLogic class to let UI know that a property's value has changed. This way UI can update itself.
Example
public class SystemLogic : INotifyPropertyChanged
{
private ComunicationStateTypeEnum _eCommStatus;
public ComunicationStateTypeEnum eCommStatus
{
get
{
return _eCommStatus;
}
set
{
_eCommStatus = value;
RaisePropertyChanged("eCommStatus");
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(String propertyName)
{
PropertyChangedEventHandler temp = PropertyChanged;
if (temp != null)
{
temp(this, new PropertyChangedEventArgs(propertyName));
}
}
}
Nothing wrong with your binding. But SystemLogic must implement INotifyPropertyChanged to report back when it is changed.
public class SystemLogic
{
private ComunicationStateTypeEnum _eCommStatus;
public ComunicationStateTypeEnum eCommStatus
{
get{return _eCommStatus;}
set
{
_eCommStatus = value;
OnPropertyChanged("ComunicationStateTypeEnum");
}
}
...
}

Resources