This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Sample of use: | |
<ComboBox ItemsSource="{Binding Source={ Extensions:ByteEnumerationExtention {x:Type type:MyEnum} }}" DisplayMemberPath="Description" | |
SelectedValuePath="Value" SelectedValue="{Binding SelectedItemInViewModel}"/> | |
public enum MyEnum : short | |
{ | |
[Description("گزینه 1")] | |
Item1 = 1, | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Net; | |
using System.Threading; | |
namespace System.Net.Sockets | |
{ | |
public class Client | |
{ | |
// Fields... | |
private Socket clientSocket = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Implements <see cref="INotifyPropertyChanged"/> and <see cref="MarshalByRefObject"/> for interception in view models. | |
/// </summary> | |
public abstract class InterceptableViewModelBase : MarshalByRefObject, INotifyPropertyChanged | |
{ | |
/// <summary> | |
/// Occurs when a property value changes. | |
/// </summary> | |
public event PropertyChangedEventHandler PropertyChanged; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using Microsoft.Practices.Prism.Logging; | |
namespace Microsoft.Practices.Prism.Logging | |
{ | |
public static class ILoggerFacadeExtensions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Microsoft.Practices.Unity | |
{ | |
public static class IUnityContainerExtensions | |
{ | |
/// <summary> | |
/// Registers a ContentControl for navigation using the name parameter. | |
/// </summary> | |
/// <typeparam name="T">The type of ContentControl to register</typeparam> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Collections.ObjectModel; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace System.Linq | |
{ | |
public static class LinqExtensions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace System | |
{ | |
public static class StringExtensions | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
How use in View? | |
<PasswordBox> | |
<i:Interaction.Behaviors> | |
<local:PasswordBoxBindingBehavior Password="{Binding Password}"/> | |
</i:Interaction.Behaviors> | |
</PasswordBox> | |
How access to orginal string? | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Microsoft.Practices.Prism.Regions | |
{ | |
/// <summary> | |
/// Represent ILoadAware functionality for View-Model classes. | |
/// </summary> | |
public interface ILoadAware | |
{ | |
/// <summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class BaseViewModel : INotifyPropertyChanged | |
{ | |
public event PropertyChangedEventHandler PropertyChanged; | |
protected virtual void OnPropertyChanged(string propertyName) | |
{ | |
PropertyChangedEventHandler handler = this.PropertyChanged; | |
if (handler != null) | |
{ | |
handler(this, new PropertyChangedEventArgs(propertyName)); |