Custom Static ref to Xaml ResourceDictionary

25 בNovember 2014

We can easily customize a strong reference to any style and than avoid Static Resources problem , like late loading or dynamic ui creation (composite applications), now since static ,resources get loaded on initialization , we could suffering some problems .Usually we dealing with those problems by Dynamic Resources :Well, nice solution could be something like that .1 :Create your style <ResourceDictionary xmlns="" xmlns:x=""> <Style TargetType="Button" x:Key="greenKey"> <Setter Property="Background" Value="Green" /> </Style> </ResourceDictionary> .2 :add static...
אין תגובות

Custom MarkUp Extension

20 בNovember 2014

..lets have some fun , customize our own markup Extension {}markup is all what inside xaml binding start with .meaning, for the xaml parser is go search for relevant function to resolve the value :To create a simple one you can do like that public class StringFormatExtension : MarkupExtension { public StringFormatExtension() { } public StringFormatExtension(int a, int b) { ...
אין תגובות

WPF Bind Collection based on ToStinrg might demolish your Binding

18 בNovember 2014

few days ago I was in a middle of WPF-MVVM workshop and I built a live demo with some Object who implement INotifyPropertyChanged interface and based on ObservableCollection to the .Listbox .this is very basic demo to show the power of the technology In this point my object Model was shows on the UI as “NameSpace.ClassName” so I just were ..decide to override the toString on it to see the Object details and all was just great ..The Problem The next level was to open the selected item in EditBox there we can try to change the item data .and see the changes on the main...
תגובה אחת

Views Locator or Navigation Service for MVVM

12 בNovember 2014

Many frameworks of MVVM provide Views Service Locator , which allow you to inject any view in .any place without reference or dependencies between libraries .Actually , it is not very hard to write one of your own if needed :For example lets try that :Base contract fro the service public interface IAppNavigationService { object ResolveView(string key); void SignView(string key, Type viewType); List<string> getAllKeys(); } :A simple version of implementation public class AppNavigationService : IAppNavigationService { ...

WPF Dynamic resources VS. Static resources

6 בNovember 2014

An old issue with opinions as much is possible if there is a performance problem depends on .Dynamic Resources As I use to say in every chance, performance talking in WPF getting more and more non-relevant .since our hardware getting more and more strong .Yet, It is important to know, that there is big different between loading static and dynamic Static resource get load when application got loading .And Dynamic resource get loading when xaml parser rendering the page Meaning, trade of between main application loading time and user interaction time .Dynamic Resources  may change during runtime, static sets only once :Like <Button Name="ButtonNew" Background="{DynamicResource TestBrush}" Click="ButtonNew_Click_1" Content="click to...
אין תגובות