I am new to Xamarin.Forms and MVVM. I have following picker in XAML:
<Picker Title="Marital Status"
x:Name="maritalStatus"
Margin="10,5,10,0"
ItemsSource="{Binding MaritalStatusList}"
ItemDisplayBinding="{Binding Value}"
SelectedItem="{Binding SelectedMaritalStatus, Mode=TwoWay}">
</Picker>
This is how I setup the item source:
public class KeyValuePair
{
public int Key { get; set; }
public string Value { get; set; }
}
public static class MaritalStatus
{
public static List<KeyValuePair> GetMaritalStatus()
{
return new List<KeyValuePair>()
{
new KeyValuePair() {Key=1, Value="Single"},
new KeyValuePair() {Key=1, Value="Married"},
new KeyValuePair() {Key=1, Value="Widowed"},
new KeyValuePair() {Key=1, Value="Divorced"},
new KeyValuePair() {Key=1, Value="Civil Partnership"}
};
}
}
And this is how I set the property:
KeyValuePair selectedMaritalStatus;
public KeyValuePair SelectedMaritalStatus
{
get => selectedMaritalStatus;
set
{
SetProperty(ref selectedMaritalStatus, value);
MaritalStatusText = selectedMaritalStatus.Value;
}
}
string maritalStatusText;
public string MaritalStatusText
{
get => maritalStatusText;
set
{
SetProperty(ref maritalStatusText, value);
}
}
The above displays properly the list in the picker. My problem is that I have a form and I want to set the picker to the value that comes from a database. I have some other entries that I can successfully set from a ViewModel like so:
foreach (EmployeeDetails details in EmployeeDetailsService.EmployeeDetails)
{
Id = details.Id;
ADEmployeeID = await new MSGraphService().GetUserIdAsync();
FirstName = details.FirstName;
MiddleName = details.MiddleName;
LastName = details.LastName;
Street = details.Address.Street;
Block = details.Address.Block;
City = details.Address.City;
County = details.Address.County;
PostCode = details.Address.PostCode;
Telephone = details.Telephone;
DateOfBirth = details.DateOfBirth != null ? DateTime.Parse(details.DateOfBirth) : DateTime.Now.Date;
CountryOfBirth = details.CountryOfBirth;
SelectedMaritalStatus.Value = details.MaritalStatus;
//MaritalStatusText = details.MaritalStatus;
PassportIssuingCountry = details.PassportIssuingCountry;
PassportNumber = details.PassportNumber;
PassportExpiryDate = details.PassportExpiryDate != null ? DateTime.Parse(details.PassportExpiryDate) : DateTime.Now.Date;
BankName = details.BankName;
BankAddress = details.BankAddress;
BankSortCode = details.BankSortCode;
NationalInsuranceNumber = details.NationalInsuranceNumber;
// //! Need to add P45
}
Marital Status picker is the only one that I cannot set, everything else works.
*** UPDATE ***
This is my SetProperty:
protected bool SetProperty<T>(ref T backingStore, T value,
[CallerMemberName] string propertyName = "",
Action onChanged = null)
{
if (EqualityComparer<T>.Default.Equals(backingStore, value)) { return false; }
backingStore = value;
onChanged?.Invoke();
OnPropertyChanged(propertyName);
return true;
}
#region INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
PropertyChangedEventHandler changed = PropertyChanged;
if (changed == null) { return; }
changed.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
Any help would be much appreciated.
SelectedMaritalStatus has to be one of the objects in MaritalStatusList
SelectedMaritalStatus = MaritalStatusList[0];
or
SelectedMaritalStatus = MaritalStatusList.First(x => x.ID == "some value from your db");
You could try to set defalut value of the Xamarin Picker. You just set the selectedIndex(the first number of index is 0) of your picker in yourpage.xaml.cs just as follows:
maritalStatus.SelectedIndex=1;
The whole code is:
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
maritalStatus.SelectedIndex = 1;
}
// other code
}
Note:
I suggest you rename your Picker to better indentify your Picker(e.g. mStatusPicker)
Related
good morning
I have the following code for a DateTimePicker, and I would like that when I press on the button, the date is shown in the Label (result), could you help me?
DateTimePicker works inherit a xamarin ContentView instead of just an Entry, xamarin and then creates the Stacklayout which xamarin add the Entry and the date and time xamarin pickers to content.
public class DateTimePicker2 : ContentView, INotifyPropertyChanged
{
public Entry Fecha { get; private set; } = new Entry() { TextColor = Color.Black, HorizontalTextAlignment=TextAlignment.Center };
public DatePicker DatePicker { get; private set; } = new DatePicker() { MaximumDate = DateTime.Today, IsVisible = false };
public TimePicker TimePicker { get; private set; } = new TimePicker() { IsVisible = false };
string stringFormat { get; set; }
public string StringFormat { get { return stringFormat ?? "dd/MM/yyyy HH:mm"; } set { stringFormat = value; } }
public DateTime DateTimed
{
get { return (DateTime)GetValue(DateTimeProperty); }
set { SetValue(DateTimeProperty, value); OnPropertyChanged("DateTime"); }
}
private TimeSpan Time
{
get
{
return TimeSpan.FromTicks(DateTimed.Ticks);
}
set
{
DateTimed = new DateTime(DateTimed.Date.Ticks).AddTicks(value.Ticks);
}
}
private DateTime date
{
get
{
return DateTimed.Date;
}
set
{
DateTimed = new DateTime(DateTimed.TimeOfDay.Ticks).AddTicks(value.Ticks);
}
}
BindableProperty DateTimeProperty = BindableProperty.Create("DateTime", typeof(DateTime), typeof(DateTimePicker2), DateTime.Now, BindingMode.TwoWay, propertyChanged: DTPropertyChanged);
public DateTimePicker2()
{
BindingContext = this;
Content = new StackLayout()
{
Children =
{
DatePicker,
TimePicker,
Fecha
}
};
TimePicker.Unfocused += (sender, args) => Time = TimePicker.Time;
DatePicker.Focused += (s, a) => UpdateEntryText();
GestureRecognizers.Add(new TapGestureRecognizer() { Command = new Command(() => DatePicker.Focus()) });
Fecha.Focused += (sender, args) => { Device.BeginInvokeOnMainThread(() => DatePicker.Focus()); };
DatePicker.Unfocused += (sender, args) => { Device.BeginInvokeOnMainThread(() => { TimePicker.Focus(); date = DatePicker.Date; UpdateEntryText();}); };
}
private void UpdateEntryText()
{
Fecha.Text = DateTimed.ToString(StringFormat);
}
static void DTPropertyChanged(BindableObject bindable, object oldValue, object newValue)
{
var timePicker = (bindable as DateTimePicker2);
timePicker.UpdateEntryText();
}
}
in Xaml it is used like this
<local:DateTimePicker2 ></local:DateTimePicker2>
<Button Clicked="Button_Clicked"> </Button>
<Label x:Name="result"></Label>
assign a name to your control
<local:DateTimePicker2 x:Name="dt2" />
<Button Clicked="Button_Clicked" />
<Label x:Name="result" />
then in your handler
protected void Button_Clicked(object sender, EventArgs e)
{
result.Text = dt2.Datetimed.ToString();
}
I have a Datagrid with two columns that bind to the same property
<DataGrid
Margin="10"
BorderBrush="Black"
BorderThickness="1"
Grid.Row="1"
Grid.ColumnSpan="3"
Items="{Binding Logs}"
AutoGenerateColumns="False"
>
<DataGrid.Columns>
<DataGridTextColumn
Header="Temp Date"
Binding="{Binding Date,Mode=TwoWay}"
>
</DataGridTextColumn>
<DataGridTemplateColumn
Header="Calendar Column"
CellTemplate="{Binding TestTemplate}"
CellEditingTemplate="{Binding EditingTemplate}"
>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
I have also created a cell template in the view model as such:
// Cell Data Template
TestTemplate = new FuncDataTemplate<EntryLog>((value, namescope) =>
new TextBlock
{
[!TextBlock.TextProperty] = new Binding("Date",BindingMode.TwoWay),
});
// Cell Editing Data Template
EditingTemplate = new FuncDataTemplate<EntryLog>((value, namescope) =>
{
var grid = new Grid();
var tb = new TextBlock
{
[!TextBlock.TextProperty] = new Binding("Date", BindingMode.TwoWay),
};
grid.Children.Add(tb);
var calendar = new Calendar();
calendar.DisplayDate = value.Date;
calendar.SelectedDate = value.Date;
Popup popup = new Popup();
popup.Child = calendar;
popup.IsOpen = true;
calendar.SelectedDatesChanged += (s, e) =>
{
value.Date = calendar.SelectedDate.Value.Date;
//tb.Text = value.Date.ToString();
};
grid.Children.Add(popup);
return grid;
});
In the UI, it looks like this when editing:
My issue is, whenever I update one column, the other column does not get updated. The itemsource is a Observable Collection of my model
My model:
public class EntryLog : INotifyPropertyChanged
{
private DateTime _date;
public DateTime Date
{
get => _date;
set
{
if (_date != value)
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Date)));
_date = value;
}
}
public string Description { get; set; }
public double Hours { get; set; }
public event PropertyChangedEventHandler? PropertyChanged;
}
Was wondering if anyone can help me out? Maybe I'm missing something that I just can't identify.
Silly me, I was invoking the propertychanged event before the change of the actual value. The correct way is just to swap that:
public class EntryLog : INotifyPropertyChanged
{
private DateTime _date;
public DateTime Date
{
get => _date;
set
{
if (_date != value)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(Date)));
_date = value;
}
}
}
public string Description { get; set; }
public double Hours { get; set; }
public event PropertyChangedEventHandler? PropertyChanged;
}
The following example works fine (https://developer.xamarin.com/samples/xamarin-forms/UserInterface/BindablePicker/)
When i try to implement it in my code, the object referenced for selectedItem is not being set. The picker is loading and selecting data fine, just not updating the object.
Here is some of the code i'm using:
XAML Page
<Picker x:Name="testpicker" Title="Select a Service" ItemsSource="{Binding Services}, Mode=TwoWay}" ItemDisplayBinding="{Binding ServiceDescription}" SelectedItem="{Binding SelectedServiceName, Mode=TwoWay}" />
I have the object in the view model, but this is never called when the picker items are selected.:
string selectedServiceName;
public string SelectedServiceName
{
get { return selectedServiceName; }
set
{
if (selectedServiceName != value)
{
selectedServiceName = value;
PickerOnPropertyChanged();
PickerOnPropertyChanged("SelectedService");
}
}
}
The binding is done from the controller when the view loads by the way....
protected async override void OnAppearing()
{
base.OnAppearing();
await viewModel.LoadPreferenceData();
await viewModel.LoadServiceData();
testpicker.SelectedIndex = 5;
}
I've also updated the base class to reflect the tutorial, i've changed the names.
Can you see anything obvious why this is not working? I'm happy to supply more code if needed.
The error was due to binding the picker to a custom type for the source.
ItemsSource="{Binding Services}
Instead of using a string for the binding object, i changed the type from:
public String SelectedServiceName
To this:
public Service SelectedServiceName
Create custom picker and implement in your code its working for me try below code :
public class CustomPicker : Picker
{
public CustomPicker()
{
SelectedIndexChanged += OnSelectedIndexChanged;
}
public static readonly BindableProperty SelectedItemProperty =
BindableProperty.Create("SelectedItem", typeof(object), typeof(CustomPicker), null, BindingMode.TwoWay, null, OnSelectedItemChanged);
public object SelectedItem
{
get { return GetValue(SelectedItemProperty); }
set
{
SetValue(SelectedItemProperty, value);
if (value != null && ItemsSource!=null && ItemsSource.Contains(value))
SelectedIndex = ItemsSource.IndexOf(value);
else
SelectedIndex = -1;
}
}
public static readonly BindableProperty ItemsSourceProperty =
BindableProperty.Create("ItemsSource", typeof(IEnumerable), typeof(CustomPicker), null, BindingMode.TwoWay, null, OnItemsSourceChanged);
public IList ItemsSource
{
get { return (IList)GetValue(ItemsSourceProperty); }
set { SetValue(ItemsSourceProperty, value); }
}
public static readonly BindableProperty DisplayPropertyProperty =
BindableProperty.Create("DisplayProperty", typeof(string), typeof(CustomPicker), null, BindingMode.TwoWay, null, OnDisplayPropertyChanged);
public string DisplayProperty
{
get { return (string)GetValue(DisplayPropertyProperty); }
set { SetValue(DisplayPropertyProperty, value); }
}
private static void OnSelectedItemChanged(BindableObject bindable, object oldValue, object newValue)
{
var picker = (CustomPicker)bindable;
picker.SelectedItem = newValue;
if (picker.ItemsSource != null && picker.SelectedItem != null)
{
var count = 0;
foreach (var obj in picker.ItemsSource)
{
if (obj == picker.SelectedItem)
{
picker.SelectedIndex = count;
break;
}
count++;
}
}
}
private static void OnDisplayPropertyChanged(BindableObject bindable, object oldValue, object newValue)
{
var picker = (CustomPicker)bindable;
picker.DisplayProperty = (string)newValue;
LoadItemsAndSetSelected(bindable);
}
private static void OnItemsSourceChanged(BindableObject bindable, object oldValue, object newValue)
{
var picker = (CustomPicker)bindable;
picker.ItemsSource = (IList)newValue;
var oc = newValue as INotifyCollectionChanged;
if (oc != null)
{
oc.CollectionChanged += (a, b) =>
{
LoadItemsAndSetSelected(bindable);
};
}
LoadItemsAndSetSelected(bindable);
}
private static void LoadItemsAndSetSelected(BindableObject bindable)
{
var picker = (CustomPicker)bindable;
if (picker.ItemsSource == null)
return;
var count = 0;
foreach (var obj in picker.ItemsSource)
{
var value = string.Empty;
if (picker.DisplayProperty != null)
{
var prop = obj.GetType().GetRuntimeProperties().FirstOrDefault(p => string.Equals(p.Name, picker.DisplayProperty, StringComparison.OrdinalIgnoreCase));
if (prop != null)
value = prop.GetValue(obj).ToString();
}
else
{
value = obj.ToString();
}
if (!picker.Items.Contains(value))
{
picker.Items.Add(value);
}
if (picker.SelectedItem != null && picker.SelectedItem == obj)
picker.SelectedIndex = count;
count++;
}
if (picker.ItemsSource.Count == picker.Items.Count - 1)
picker.SelectedIndex++;
}
private void OnSelectedIndexChanged(object sender, EventArgs e)
{
if (SelectedIndex > -1)
{
SelectedItem = ItemsSource[SelectedIndex];
}
}
}
Xaml Code
<userControls:CustomPicker BackgroundColor="Transparent" x:Name="testpicker" HorizontalOptions="FillAndExpand" ItemsSource="{Binding Services}" SelectedItem="{Binding SelectedServiceName}" DisplayProperty="{Binding ServiceDescription}" />
Don't forgot put in Xaml header
xmlns:userControls="clr-namespace:MyNameSpace"
I am trying to make cascading dropdown list in ASP.NET MVC4, both values for my dropdown list's comes from methods, so am in trouble how to pass value form one dropdown list to another.
Here's how I get values for the first dropdown list:
var CampaignInfo1 = CampaignManagementService.GetAdvertisers((string)Session["ticket"]);
List<CampaignList1> items1 = new List<CampaignList1>();
foreach (var element in CampaignInfo1)
{
items1.Add(new CampaignList1() { ID1 = element.Key, Name1 = element.Value });
}
var listOfCamp1 = new SelectList(items1, "ID1", "Name1", 1);
ViewData["list1"] = listOfCamp1;
And dropdown list in view:
#Html.DropDownList("list1", ViewData["list1"] as SelectList, "-- Select Client -1-")
The second dropdown list value am getting almost same method:
var CampaignInf = CampaignManagementService.GetCampaigns((string)Session["ticket"], IDFromfirstDDL);
List<AlreadyCreatedCampaignList> itemas = new List<AlreadyCreatedCampaignList>();
foreach (var element in CampaignInf)
{
itemas.Add(new AlreadyCreatedCampaignList() { campID = element.Key, campName = element.Value });
}
var listOfCam = new SelectList(itemas, "campID", "campName", 1);
ViewData["clist"] = listOfCam;
But there is a problem that in method GetCampaigns I have to pass the id(IDFromfirstDDL) which I get from first DDL, and only then method return values which are for that id.
The problem is that I don't know how to pass that selected value from first DDL to second, without any form submit, because I need that second DDL changes his values immediately after first DDL changes.
i made it combining http://kruisit.nl/articles/asp.net-mvc-linked-dropdown/ and http://www.appelsiini.net/projects/chained jquery chained selector this article
currently using in my site
public static class LinkedDropdownHelper
{
#region Methods
public static MvcHtmlString LinkedDropdownListFor<TModel, TProperty>(this HtmlHelper<TModel> htmlHelper, Expression<Func<TModel, TProperty>> expression, string parent, IEnumerable<LinkedSelectListItem> selectList ,bool removedefault=false)
{
ModelMetadata metadata = ModelMetadata.FromLambdaExpression( expression,htmlHelper.ViewData );
var selectedvalue = metadata.Model;
string propertyName = metadata.PropertyName;
TagBuilder select = new TagBuilder("select");
select.Attributes.Add("id", propertyName);
select.Attributes.Add("name", propertyName);
//select.Attributes.Add("class", "linked-dropdown");
select.Attributes.Add("class", parent);
foreach (var item in selectList)
{
if (removedefault && item.Value == "-1")
{
//skip default
}
else
{
TagBuilder option = new TagBuilder("option");
option.InnerHtml = item.Text;
option.Attributes.Add("value", item.Value);
option.Attributes.Add("class", item.LinkValue);
if (item.Selected)
{
option.Attributes.Add("selected", "selected");
}
select.InnerHtml += option.ToString(TagRenderMode.Normal);
}
}
//below code was changed by abdurrauf to support jquery chains
string script = #"<script type='text/javascript'>$(document).bind('ready', function(){
$('#" + propertyName + "').chained('#" + parent + "');"+
#"$('select[name=""" + propertyName + #"""]').val("""+selectedvalue+#""");" +
"});</script>";
return MvcHtmlString.Create(script + select.ToString(TagRenderMode.Normal));
}
#endregion Methods
}
public class LinkedSelectList : IEnumerable<LinkedSelectListItem>
{
#region Constructors
public LinkedSelectList(IEnumerable items, string dataValueField, string dataTextField, string dataLinkedValueField, IEnumerable selectedValues)
{
if (items == null)
{
throw new ArgumentNullException("items");
}
Items = items;
DataValueField = dataValueField;
DataTextField = dataTextField;
DataLinkedValueField = dataLinkedValueField;
SelectedValues = selectedValues;
}
#endregion Constructors
#region Properties
public string DataLinkedValueField
{
get; private set;
}
public string DataTextField
{
get; private set;
}
public string DataValueField
{
get; private set;
}
public IEnumerable Items
{
get; private set;
}
public IEnumerable SelectedValues
{
get; private set;
}
#endregion Properties
#region Methods
public virtual IEnumerator<LinkedSelectListItem> GetEnumerator()
{
return GetListItems().GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
internal IList<LinkedSelectListItem> GetListItems()
{
return GetListItemsWithValueField();
}
private static string Eval(object container, string expression)
{
object value = container;
if (!String.IsNullOrEmpty(expression))
{
value = DataBinder.Eval(container, expression);
}
return Convert.ToString(value, CultureInfo.CurrentCulture);
}
private IList<LinkedSelectListItem> GetListItemsWithValueField()
{
HashSet<string> selectedValues = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
if (SelectedValues != null)
{
selectedValues.UnionWith(from object value in SelectedValues select Convert.ToString(value, CultureInfo.CurrentCulture));
}
var listItems = from object item in Items
let value = Eval(item, DataValueField)
select new LinkedSelectListItem
{
Value = value,
Text = Eval(item, DataTextField),
LinkValue = Eval(item, DataLinkedValueField),
Selected = selectedValues.Contains(value)
};
return listItems.ToList();
}
#endregion Methods
}
public class LinkedSelectListItem
{
#region Properties
public string LinkValue
{
get; set;
}
public bool Selected
{
get; set;
}
public string Text
{
get; set;
}
public string Value
{
get; set;
}
#endregion Properties
}
Hai i'm doing one silverlight app that uses MVVM architecture.
The Scenario is this. I have one combobox and datagrid in same page.
I have use ObservableCollection to bind the values in Datagrid and in that collection i have three fields namely Fname,Sname and Dept.
I bind Dept in Combobox but if i select any one of department means that value does not update in DataGrid. ie., i have created the code in ViewModel and i use LINQ query and i have Fetched the value also in,
var semp = from s in Employees where s.Dept.Equals(Names.Dept) select s;
i need to send this semp datasource to Datagrid in View.
Datagrid Syntax is :
<my:DataGrid x:Name="McDataGrid" ItemsSource="{Binding Employees,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" Margin="130,151,0,0" Height="137" VerticalAlignment="Top" RowBackground="#AA5D9324" AutoGenerateColumns="True" HorizontalAlignment="Left" Width="196">
</my:DataGrid>
Help me if u Know...
This is the ViewModel Code:
using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using System.ComponentModel;
using Silverlight_MVVM.Model;
using Silverlight_MVVM.Utils;
using System.Linq;
using System.Collections.Generic;
namespace Silverlight_MVVM.ViewModel
{
public class EmployeeListViewModel:INotifyPropertyChanged
{
public ObservableCollection<Employee> Employees { get; private set; }
public EmployeeListViewModel()
{
Employees = Silverlight_MVVM.DataHelper.EmployeeDataHelper.EmployeeData ();
}
private string _fname;
public string Fname
{
get
{
return _fname;
}
set
{
_fname = value;
RaisePropertyChanged("Fname");
}
}
private string _sname;
public string Sname
{
get
{
return _sname;
}
set
{
_sname = value;
RaisePropertyChanged("Sname");
}
}
private string _dept;
public string Dept
{
get
{
return _dept;
}
set
{
_dept = value;
RaisePropertyChanged("Dept");
}
}
private Employee _SelectedEmployee;
public Employee SelectedEmployee
{
get
{
return _SelectedEmployee;
}
set
{
_SelectedEmployee = value;
RaisePropertyChanged("SelectedEmployee");
}
}
private string _demp;
public string demp
{
get
{
return _demp;
}
set
{
_demp = value;
RaisePropertyChanged("demp");
}
}
private Employee _Names;
public Employee Names
{
get
{
return _Names;
}
set
{
_Names = value;
List<Employee> myList = new List<Employee>();
IEnumerable<Employee> myEnumerable = myList;
// List<Employee> listAgain = myEnumerable.ToList();
// Employees = (ObservableCollection<Employee>)Employees.Where(_ => _.Dept.Equals(Names.Dept));
RaisePropertyChanged("Names");
}
}
public void HandleShowMessage()
{
// MessageBox.Show("Hello " + Names + ",Welcome to EventTrigger for MVVM.");
}
public RelayCommand _AddEmployeeCommand;
/// <summary>
/// Returns a command that show the customer.
/// </summary>
public ICommand AddEmployeeCommand
{
get
{
if (_AddEmployeeCommand == null)
{
_AddEmployeeCommand = new RelayCommand(
param => this.AddEmployee(),
param => this.CanAddEmployee
);
}
return _AddEmployeeCommand;
}
}
public bool CanAddEmployee
{
get
{
return true;
}
}
public void AddEmployee()
{
Employee newEmployee = new Employee();
if (Names == null)
{
newEmployee.Fname = this.Fname;
newEmployee.Sname = this.Sname;
newEmployee.Dept = this.Dept;
Employees.Add(newEmployee);
//SelectedEmployee = newEmployee.ToString();
}
else //This is the event for getting selected item through combobox and the linq query fetching
{
Employees = Silverlight_MVVM.DataHelper.EmployeeDataHelper.EmployeeData();
var semp = from emp in Employees where emp.Dept.Equals(Names.Dept) select emp;
}
}
#region INotifyPropertyChanged
// [field: NonSerialized]
public event PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
}
}