{"id":210778,"date":"2014-01-29T23:13:12","date_gmt":"2014-01-29T19:13:12","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=210778"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=210778","title":{"rendered":"<span class=\"post_title\">WinPhone: \u043f\u0443\u0442\u0438 \u043a \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u0443<\/span>"},"content":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439, \u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440-\u0440\u0438\u0441\u043e\u0432\u0430\u043b\u043a\u0443 \u043f\u043e\u0434 Windows Phone. \u0414\u0443\u043c\u0430\u044e, \u0434\u0430\u0436\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0439\u0442\u0438 \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0447\u0442\u043e-\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u0438 \u043d\u043e\u0432\u043e\u0435. \u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0438\u0448\u043a\u043e\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0432 \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435 \u043e\u0442\u043c\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0443\u0436\u043d\u0430\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u043b\u0437\u0443\u043d\u043a\u0430-\u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0430. \u0418 \u0434\u0430, \u0432 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043c\u044b \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u0440\u0430\u0434\u0443\u0433\u0443! \u041f\u043e\u0435\u0445\u0430\u043b\u0438\u2026<\/p>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b <a href=\"https:\/\/vent.codeplex.com\/\">\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440<\/a>.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/aa5\/999\/039\/aa5999039ec51c0d500634a08db8c90a.png\" alt=\"image\"\/><br \/>   <a name=\"habracut\"><\/a><\/p>\n<p>  <b>\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438 (markup extensions)<\/b><\/p>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0430\u043b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0430 WinPhone, \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0440\u0430\u0437\u0443 \u0431\u044b\u043b \u0440\u0430\u0437\u043e\u0447\u0430\u0440\u043e\u0432\u0430\u043d \u0446\u0435\u043b\u044b\u043c \u0440\u044f\u0434\u043e\u043c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u044d\u0442\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0437\u0434\u0435\u0441\u044c \u0434\u0430\u0436\u0435 \u043d\u0435\u0442 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u0445 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439 \u0440\u0430\u0437\u043c\u0435\u0442\u043a\u0438, \u043a\u0430\u043a \u0432 WPF \u0438\u043b\u0438 Silverlight. \u0412\u0435\u0434\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u043b\u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u0435\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434 \u0432 xaml:<\/p>\n<pre><code class=\"xml\">&lt;TextBlock Text={Localizing Hello}\/&gt; &lt;Button Content={Picture New.png}\/&gt; <\/code><\/pre>\n<p>  \u00ab\u041a\u0430\u043a \u0436\u0435 \u0442\u0430\u043a?! \u0412\u0435\u0434\u044c \u043d\u0430\u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0434\u043e\u0431\u043d\u0430\u044f \u0448\u0442\u0443\u043a\u0430\u00bb, \u2014 \u043f\u043e\u0434\u0443\u043c\u0430\u043b \u044f \u0438 \u043d\u0430 \u0434\u043e\u0441\u0443\u0433\u0435 \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0435\u0435, \u0438 \u043d\u0435 \u0437\u0440\u044f.<\/p>\n<p>  \u041f\u043e\u043a\u043e\u043f\u0430\u0432\u0448\u0438\u0441\u044c \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043e\u043c \u043e\u0442 \u0440\u0435\u0448\u0430\u0440\u043f\u0435\u0440\u0430 \u0432 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u0447\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0430\u0445, \u044f \u0432\u0434\u0440\u0443\u0433 \u0437\u0430\u043c\u0435\u0442\u0438\u043b, \u0447\u0442\u043e \u043a\u043b\u0430\u0441\u0441 Binding \u043d\u0435 \u043f\u043e\u043c\u0435\u0447\u0435\u043d \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c sealed, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e\u0433\u043e \u0432 WPF. \u0410 \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0443\u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0435\u0433\u043e, \u043c\u0435\u043b\u044c\u043a\u043d\u0443\u043b\u043e \u0432 \u0433\u043e\u043b\u043e\u0432\u0435? \u041f\u043e\u043f\u0440\u043e\u0431\u0432\u0430\u043b, \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c!<\/p>\n<pre><code class=\"cs\">   public abstract class MarkupExtension : Binding, IValueConverter     {         protected MarkupExtension()         {             Source = Converter = this;         }          protected MarkupExtension(object source) \/\/ set Source to null for using DataContext         {             Source = source;             Converter = this;         }          protected MarkupExtension(RelativeSource relativeSource)         {             RelativeSource = relativeSource;             Converter = this;         }          public abstract object Convert(object value, Type targetType, object parameter, CultureInfo culture);          public virtual object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)         {             throw new NotImplementedException();         }     } <\/code><\/pre>\n<p>  \u0412\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0432\u044b\u0448\u0435\u043b. \u0410 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u0440\u0438\u043c\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<pre><code class=\"cs\">    public class Localizing : MarkupExtension     {         public static readonly LocalizingManager Manager = new LocalizingManager();          public Localizing()         {             Source = Manager;             Path = new PropertyPath(&quot;Source&quot;);         }          public string Key { get; set; }          public override string ToString()         {             return Convert(Manager.Source, null, Key, Thread.CurrentThread.CurrentCulture) as string ??                    string.Empty;         }          public override object Convert(object value, Type targetType, object parameter, CultureInfo culture)         {             var key = Key;             var resourceManager = value as ResourceManager;             if (resourceManager == null || string.IsNullOrEmpty(key)) return &quot;:&quot; + key + &quot;:&quot;;             var localizedValue = resourceManager.GetString(key);             return localizedValue ?? &quot;:&quot; + key + &quot;:&quot;;         }     }      public class LocalizingManager : INotifyPropertyChanged     {         private ResourceManager _source;         public ResourceManager Source         {             get { return _source; }             set             {                 _source = value;                 PropertyChanged(this, new PropertyChangedEventArgs(&quot;Source&quot;));             }         }          public event PropertyChangedEventHandler PropertyChanged = (sender, args) =&gt; { };     } <\/code><\/pre>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0438 \u043d\u0430 WinPhone \u043c\u043e\u0436\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c<\/p>\n<pre><code class=\"xml\"> &lt;TextBlock Text=&quot;{f:Localizing Key=ApplicationTitle}&quot;\/&gt; <\/code><\/pre>\n<p>  \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u043e\u0442 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0430 f: \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0438\u0437-\u0437\u0430 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b, \u0442\u0430\u043a\u0436\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0438\u043c\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 Key, \u043d\u043e \u0438 \u044d\u0442\u043e \u0443\u0436\u0435 \u043b\u0443\u0447\u0448\u0435, \u0447\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c<\/p>\n<pre><code class=\"xml\">&lt;TextBlock Text=&quot;{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}&quot;\/&gt; <\/code><\/pre>\n<p>  \u041a\u0441\u0442\u0430\u0442\u0438, \u043d\u0430\u0448\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0433\u043e\u0440\u044f\u0447\u0443\u044e \u0441\u043c\u0435\u043d\u0443 \u044f\u0437\u044b\u043a\u0430 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0447\u0442\u043e \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u043b\u0435\u0442\u0443. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 MarkupExtension \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0432\u0435\u0449\u0435\u0439. \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  \u041f\u0440\u0435\u0434\u043e\u0441\u0442\u0435\u0440\u0435\u0433\u0443 \u043e\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0432\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u0430\u043c\u043d\u044f. \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440 MarkupExtension(RelativeSource relativeSource), \u0442\u043e \u0432 \u043c\u0435\u0442\u043e\u0434 Convert \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 value \u043f\u0440\u0438\u0434\u0451\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0430. \u0421 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043e\u043c \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0451, \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e, \u043d\u043e \u0435\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u0433\u043e \u0436\u0451\u0441\u0442\u043a\u0443\u044e \u0441\u0441\u044b\u043b\u043a\u0443, \u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f \u0441 \u0443\u0442\u0435\u0447\u043a\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u0430\u043d\u043e \u0441\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0430, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0441\u0431\u043e\u0440\u043a\u0438 \u043c\u0443\u0441\u043e\u0440\u0430 \u0447\u0430\u0441\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u0434\u0430\u0436\u0435 \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u0440\u044b\u0442\u043e \u0438 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u0434\u043b\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0446\u0435\u043b\u0435\u0439 \u043b\u0435\u043d\u0438\u0432\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 (WeakReferences).<\/p>\n<p>  <b>\u0420\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b (shared commands)<\/b><\/p>\n<p>  \u0421 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438 \u0432 WinPhone \u0434\u0435\u043b\u0430 \u043e\u0431\u0441\u0442\u043e\u044f\u0442 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e, \u0438\u0445 \u043d\u0443\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443. \u041f\u0440\u0438\u0447\u0451\u043c, \u0442\u0443\u0442 \u0442\u043e\u0436\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u044b\u043c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u043e\u043d\u0442\u0440\u043e\u043b \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 CanExecuteChanged, \u0438 \u0435\u0441\u043b\u0438 \u044d\u0442\u0443 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0443 \u043d\u0435\u0433\u0440\u0430\u043c\u043e\u0442\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0451 \u0442\u0435 \u0436\u0435 \u0443\u0442\u0435\u0447\u043a\u0438 \u043f\u0430\u043c\u044f\u0442\u0438. \u042f \u0438 \u0441\u0430\u043c \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u043b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043d\u044e\u0430\u043d\u0441, \u043d\u043e \u043c\u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043b \u043d\u0430 \u043d\u0435\u0433\u043e \u043c\u043e\u0439 \u0442\u043e\u0432\u0430\u0440\u0438\u0449 \u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u044b\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u042e\u0440\u0438\u0439 \u041a\u0430\u043b\u0438\u043d\u043e\u0432, \u0437\u0430 \u0447\u0442\u043e \u0445\u043e\u0447\u0443 \u043f\u043e\u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0438\u0442\u044c \u0435\u0433\u043e. \u041f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435 \u043c\u043e\u0436\u043d\u043e <a href=\"http:\/\/stackoverflow.com\/questions\/12919288\/icommand-binding-causing-ui-memory-leak-in-wpf-application\">\u0442\u0443\u0442<\/a>.<\/p>\n<p>  \u0422\u043e \u043b\u0438 \u0434\u0435\u043b\u043e \u0432 WPF \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c RoutedCommands \u0438 CommandBindings. \u0412 <a href=\"http:\/\/habrahabr.ru\/post\/208326\/\">\u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a> \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u0410 \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0430 WinPhone \u043d\u0435\u0447\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435? \u041f\u043e\u0441\u0432\u044f\u0442\u0438\u0432 \u0432\u0435\u0447\u0435\u0440 \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u044f-\u0442\u0430\u043a\u0438 \u0434\u043e\u0441\u0442\u0438\u0433 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0432\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u043a\u043e\u043d\u0446\u0435\u043f\u0446\u0438\u044e \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0435\u043c\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 (shared commands). \u041e\u043d\u0438 \u043d\u0435 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043f\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0434\u0435\u0440\u0435\u0432\u0443, \u043d\u043e \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442 \u043a\u0430\u043a \u043d\u0435\u043b\u044c\u0437\u044f \u043b\u0443\u0447\u0448\u0435. \u0421\u0440\u0430\u0437\u0443 \u043e\u0442\u0441\u044b\u043b\u0430\u044e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044f \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0438\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u0437\u0434\u0435\u0441\u044c \u0436\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0438\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f. \u0412\u0441\u0451 \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u0443\u0434\u043e\u0431\u043d\u043e, \u0432\u043e \u0432\u044c\u044e \u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u0438\u0448\u0435\u043c \u043a\u0430\u043a-\u0442\u043e \u0442\u0430\u043a<\/p>\n<pre><code class=\"cs\">this[SharedCommands.Back].CanExecute += (sender, args) =&gt; args.CanExecute = TouchIndex &gt; 0; this[SharedCommands.Next].CanExecute += (sender, args) =&gt; args.CanExecute = TouchIndex &lt; _toches.Count; this[SharedCommands.Back].Executed += (sender, args) =&gt; TouchIndex--; this[SharedCommands.Next].Executed += (sender, args) =&gt; TouchIndex++;  <\/code><\/pre>\n<p>  \u0410 \u043d\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435<\/p>\n<pre><code class=\"xml\">&lt;Button Command=&quot;{f:Command Key=Back}&quot; Content=&quot;{f:Picture Key=\/Resources\/IconSet\/Next.png, Width=32, Height=32}&quot;\/&gt; &lt;Button Command=&quot;{f:Command Key=Next}&quot; Content=&quot;{f:Picture Key=\/Resources\/IconSet\/Next.png, Width=32, Height=32}&quot;\/&gt; <\/code><\/pre>\n<p>  <b>\u041b\u044f\u043c\u0431\u0434\u0430-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/b><\/p>\n<p>  \u041d\u043e\u0442\u0438\u0444\u0438\u0430\u0446\u0438\u044f \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0432\u044c\u044e-\u043c\u043e\u0434\u0435\u043b\u0438 \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043b\u044f\u043c\u0431\u0434\u0430-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441\u0438\u043a\u0430<\/p>\n<pre><code class=\"cs\">        public Tool Tool         {             get { return Get(() =&gt; Tool); }             set { Set(() =&gt; Tool, value); }         } <\/code><\/pre>\n<p>  \u0415\u0449\u0451 \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u043e\u0431\u043d\u043e \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u0442\u043e\u0440<\/p>\n<pre><code class=\"cs\">            this[() =&gt; Background].PropertyChanged += (sender, args) =&gt;             {                 Canvas.Children.Clear();                 Canvas.Background = Background;                 _toches.GetRange(0, TouchIndex).ForEach(Canvas.Children.Add);             }; <\/code><\/pre>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u043a\u043e\u0433\u043e-\u0442\u043e \u0435\u0449\u0451 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u043e\u043f\u0430\u0441\u0435\u043d\u0438\u044f \u043d\u0430\u0441\u0447\u0451\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0430\u043a\u0438\u0445 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u0442\u043e \u0441\u043c\u0435\u044e \u0438\u0445 \u0440\u0430\u0437\u0432\u0435\u044f\u0442\u044c \u2014 \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u043e. \u041f\u043e\u043c\u043d\u044e, \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u043a\u0442\u043e-\u0442\u043e \u0432\u044b\u043b\u043e\u0436\u0438\u043b \u043d\u0430 \u0445\u0430\u0431\u0440\u0435 \u0434\u0438\u0437\u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u043a\u0430\u0439\u043f\u0430 \u0434\u043b\u044f WinPhone, \u0430 \u0437\u0430\u0442\u0435\u043c \u044d\u0442\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u0443\u0431\u0440\u0430\u043b\u0438, \u043d\u043e \u044f \u0443\u0441\u043f\u0435\u043b \u0438\u0445 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0438 \u043f\u043e\u0434\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u0442\u0430\u043c \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u0432\u044c\u044e-\u043c\u043e\u0434\u0435\u043b\u0438. \u042d\u0442\u043e \u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u043e \u043a\u0430\u043a \u0440\u0430\u0437-\u0442\u0430\u043a\u0438 \u0432 \u043d\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b\u0438\u0441\u044c \u043b\u044f\u043c\u0431\u0434\u0430-\u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432. \u0414\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0441\u043a\u0430\u0439\u043f \u0434\u0435\u043b\u0430\u043b\u0438 \u0443\u043c\u043d\u044b\u0435 \u043b\u044e\u0434\u0438 \u0438\u0437 \u041c\u0430\u0439\u043a\u0440\u0430\u0441\u043e\u0444\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0434\u043e\u0432\u0435\u0440\u0438\u0435 \u043a \u043d\u0438\u043c \u0435\u0441\u0442\u044c. \u0410 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0441\u043a\u0430\u0439\u043f\u0430 \u043f\u043e\u0442\u043e\u043c \u0431\u044b\u043b\u0438 \u0443\u0434\u0430\u043b\u0435\u043d\u044b \u0441 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \ud83d\ude09<\/p>\n<p>  <b>\u0420\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u0435<\/b><\/p>\n<p>  \u041c\u044b \u043f\u043e\u0434\u043e\u0448\u043b\u0438 \u043a \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u043c\u0443 \u2013 \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044e. \u041a\u0430\u043a \u0435\u0433\u043e \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u043c\u043e\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b? \u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043f\u0440\u043e\u0449\u0435 \u0438 \u043b\u043e\u0433\u0438\u0447\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u043c\u0438 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b Canvas, Polyline \u0438 \u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435. \u041f\u043e\u0447\u0435\u043c\u0443 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0438\u043c\u0435\u043d\u043d\u043e \u0438\u0445, \u0430 \u043d\u0435 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, WritableBitmap, \u0434\u0430 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0434\u043b\u044f \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u044f\u0434\u0440\u043e \u043b\u0438\u0431\u043e SIMD \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u043d\u043e \u0435\u0441\u043b\u0438 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0443\u043a\u0430\u043c\u0438, \u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u043b\u043e\u0436\u0438\u043c \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u0447\u0442\u043e \u0441\u043d\u0438\u0437\u0438\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u043b\u043e\u0436\u043d\u0438\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443.<\/p>\n<p>  \u0421\u0443\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c. \u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0445\u043e\u043b\u0441\u0442 (<code>Canvas<\/code>), \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435, \u0430 \u043b\u044e\u0431\u044b\u0435 \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u044f \u043a \u043d\u0435\u043c\u0443 \u043c\u044b \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c \u043a\u0430\u043a \u043c\u0430\u0437\u043a\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u043a\u0438\u0441\u0442\u044c\u044e. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u0430\u0437\u043a\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432, \u0430 \u0437\u0430\u0442\u0435\u043c \u043e\u043d \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e <code>Canvas.Children<\/code>. \u041d\u043e \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0442\u044b\u0441\u044f\u0447\u0430 \u0442\u0430\u043a\u0438\u0445 \u043c\u0430\u0437\u043a\u043e\u0432, \u043e\u0442\u0440\u0430\u0437\u0438\u0442\u0441\u044f \u043b\u0438 \u044d\u0442\u043e \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438? \u0414\u0430, \u043e\u0442\u0440\u0430\u0437\u0438\u0442\u0441\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0443\u0436\u043d\u043e \u0445\u043e\u0442\u044f \u0431\u044b \u0432\u0440\u0435\u043c\u0435\u043d\u0430\u043c\u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u0442\u043e \u0435\u0441\u0442\u044c \u043e\u0447\u0438\u0449\u0430\u0442\u044c <code>Canvas.Children<\/code> \u0438 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0432 Canvas.Background \u0442\u043e\u0442 \u0440\u0438\u0441\u0443\u043d\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a<\/p>\n<pre><code class=\"cs\">            var raster = new WriteableBitmap(Canvas, null);             Canvas.Background = new ImageBrush             {                 AlignmentX = AlignmentX.Left,                 AlignmentY = AlignmentY.Top,                 Stretch = Stretch.None,                 ImageSource = raster,             };              Canvas.Children.Clear(); <\/code><\/pre>\n<p>  \u0420\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044f \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u043f\u0435\u0440\u0435\u0434 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0430, \u043d\u043e \u043a\u0430\u043a \u0436\u0435 \u043d\u0430\u043c \u0442\u043e\u0433\u0434\u0430 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u044e, \u0432\u0435\u0434\u044c \u043f\u0440\u0438 \u0440\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u043d\u0430 \u0443\u0442\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f? \u0417\u0434\u0435\u0441\u044c \u0442\u043e\u0436\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u2013 \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043c \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 Background \u0445\u043e\u043b\u0441\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u044b\u043b \u0434\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u044f, \u0438 \u0437\u0430\u0432\u0435\u0434\u0451\u043c \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e <code>List&lt;UIElement&gt; _toches<\/code> \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u0440\u0438\u043a\u043e\u0441\u043d\u043e\u0432\u0435\u043d\u0438\u0439. \u041a\u043e\u0433\u0434\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043c\u043e\u0442\u0430\u0442\u044c \u0438\u0441\u0442\u043e\u0440\u0438\u044e \u043d\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0432\u0439 \u0444\u043e\u043d \u0443 \u0445\u043e\u043b\u0441\u0442\u0430 \u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c \u043d\u0443\u0436\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 <code>_toches<\/code> \u0432 <code>Canvas.Children<\/code>, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043d\u0435 \u0443\u0434\u0430\u043b\u044f\u044e\u0442\u0441\u044f \u0438\u0437 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 <code>_toches<\/code>.<\/p>\n<p>  \u0412 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0434\u0432\u0443\u043c\u044f \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438: \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 Polyline \u0438 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 OpacityMask \u0443 Canvas. \u0412\u0442\u043e\u0440\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043c\u043d\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u0430\u043b \u0442\u0430\u043b\u0430\u043d\u0442\u043b\u0438\u0432\u044b\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u042f\u0440\u043e\u0448\u0435\u0432\u0438\u0447 \u042e\u0440\u0438\u0439, \u0437\u0430 \u0447\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u044e \u0435\u043c\u0443 \u0441\u043f\u0430\u0441\u0438\u0431\u043e. <\/p>\n<p>  \u0418\u043d\u0442\u0435\u0440\u0435\u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0442\u0430\u043a\u0436\u0435 \u043b\u043e\u0433\u0438\u043a\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0442\u0451\u0440\u043a\u0438 (\u0432\u043e\u0434\u0430). \u0420\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043e \u043d\u0435\u0439 \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435 \u0431\u0443\u0434\u0443, \u043d\u043e \u0441\u0430\u043c\u044b\u0435 \u043f\u044b\u0442\u043b\u0438\u0432\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u0430\u043c\u0438 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441.<\/p>\n<p>  <b>\u0420\u0430\u0434\u0443\u0433\u0430<\/b><\/p>\n<p>  \u041a\u0430\u043a \u0438 \u043e\u0431\u0435\u0449\u0430\u043b, \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u043e \u0440\u0438\u0441\u043e\u0432\u0430\u043d\u0438\u0438 \u043f\u0430\u043b\u0438\u0442\u0440\u044b \u0446\u0432\u0435\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0434\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 \u043a\u0438\u0441\u0442\u0438. \u0412\u0441\u0451, \u0447\u0442\u043e \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u2013 \u044d\u0442\u043e \u0440\u0430\u0434\u0443\u0436\u043d\u0430\u044f \u043a\u0438\u0441\u0442\u044c.<\/p>\n<pre><code class=\"xml\">        &lt;LinearGradientBrush x:Key=&quot;RainbowBrush&quot; StartPoint=&quot;0 0&quot; EndPoint=&quot;0 0.6&quot;&gt;             &lt;LinearGradientBrush.Transform&gt;                 &lt;ScaleTransform ScaleY=&quot;2.8&quot;\/&gt;             &lt;\/LinearGradientBrush.Transform&gt;             &lt;LinearGradientBrush.GradientStops&gt;                 &lt;GradientStop Color=&quot;#FFFF0000&quot; Offset=&quot;0.0&quot;\/&gt;                 &lt;GradientStop Color=&quot;#FFFFFF00&quot; Offset=&quot;0.1&quot;\/&gt;                 &lt;GradientStop Color=&quot;#FF00FF00&quot; Offset=&quot;0.2&quot;\/&gt;                 &lt;GradientStop Color=&quot;#FF00FFFF&quot; Offset=&quot;0.3&quot;\/&gt;                 &lt;GradientStop Color=&quot;#FF0000FF&quot; Offset=&quot;0.4&quot;\/&gt;                 &lt;GradientStop Color=&quot;#FFFF00FF&quot; Offset=&quot;0.5&quot;\/&gt;                 &lt;GradientStop Color=&quot;#FFFF0000&quot; Offset=&quot;0.6&quot;\/&gt;             &lt;\/LinearGradientBrush.GradientStops&gt;         &lt;\/LinearGradientBrush&gt; <\/code><\/pre>\n<p>  \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0430 \u044d\u0442\u043e\u043c \u0432\u0441\u0451 \u2013 \u0438\u0437\u0443\u0447\u0430\u0439\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043d\u0451\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b \u0437\u0434\u0435\u0441\u044c. \u0414\u043b\u044f \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e <a href=\"http:\/\/habrahabr.ru\/post\/208326\/\">MVVM: \u043d\u043e\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434<\/a>. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043b \u043d\u0430 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u044e, \u0447\u0442\u043e \u043d\u0430 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e, \u043e\u0434\u043d\u0430\u043a\u043e \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u044b\u0445 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0435\u0439 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e.<\/p>\n<p>  \u0412\u0441\u0435\u043c \u043c\u0438\u0440!    \t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/210778\/\"> http:\/\/habrahabr.ru\/post\/210778\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">   \t\u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439, \u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440-\u0440\u0438\u0441\u043e\u0432\u0430\u043b\u043a\u0443 \u043f\u043e\u0434 Windows Phone. \u0414\u0443\u043c\u0430\u044e, \u0434\u0430\u0436\u0435 \u043e\u043f\u044b\u0442\u043d\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0439\u0442\u0438 \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u0447\u0442\u043e-\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435 \u0438 \u043d\u043e\u0432\u043e\u0435. \u0423\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0444\u0438\u0448\u043a\u043e\u0439 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u0442\u043e\u0440\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0432 \u0431\u0443\u043a\u0432\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435 \u043e\u0442\u043c\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u043d\u0443\u0436\u043d\u0430\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u043e\u043b\u0437\u0443\u043d\u043a\u0430-\u0441\u043b\u0430\u0439\u0434\u0435\u0440\u0430. \u0418 \u0434\u0430, \u0432 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043c\u044b \u043d\u0430\u0440\u0438\u0441\u0443\u0435\u043c \u0440\u0430\u0434\u0443\u0433\u0443! \u041f\u043e\u0435\u0445\u0430\u043b\u0438\u2026<\/p>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b <a href=\"https:\/\/vent.codeplex.com\/\">\u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440<\/a>.<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/aa5\/999\/039\/aa5999039ec51c0d500634a08db8c90a.png\" alt=\"image\"\/>   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-210778","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/210778","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=210778"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/210778\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=210778"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=210778"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=210778"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}