Custom Markup extension Translator

Wednesday, September 9, 2015

One of the most commonly ways to obtain markup of xaml, I posting it after I promised to my students public class TranslateTextExtension : MarkupExtension { public TranslateTextExtension() { spanishDic = new Dictionary<string, string>(); hebrewDic = new Dictionary<string, string>(); englishhDic = new Dictionary<string, string>(); ...
2 תגובות

Using Dictionary as Binding source for Xaml Collection

Wednesday, August 26, 2015

If you find the trigger just pull it off.. Unfortunately I have found more than once programmers who used to translate the dictionary struct into an IEnumerable to present one dimension collection at the UI, And its is not because ObseervableCollection problem since it is quite easy to have an ObservableDictionary if you have the Notification binding consideration. Assume you have an Dictionary of key value in your model, lets say of CustomerName, and a Customer, while you already have it, and all what yours App is about Customer Names in DropDown List, but in underline you do need the real Entity...
אין תגובות

Xaml – Validation – IdataErrorInfo with RegX

Monday, August 10, 2015

WPF provide the well-known Validation mechanism, its colored with red border the under-validation-control.        I have been recently asked few times how to use it, so here is the simple and shortest demo you might find. At the ViewModel: Implement IDataErrorInfo interface from ComponentModel , Its provide a indexer which get called only if you defined validation connection on Xaml. public class viewModelDemo : IDataErrorInfo { public string Error { get { throw new NotImplementedException(); } ...
אין תגובות

ADV. Xaml Programing part 2 – binding to Methods

Thursday, July 2, 2015

Usually binding has been designed for properties, But there is exceptional cases of course, generally not because of yours architecture but because others, The point is that is possible, Let’s start with ObjectDataProvider . it is an old trick to represents data in xaml endpoint, And make the things shorter, In this case we just define a Xaml reference to the class who hold the desired function For Example : public static class HelperBinding { public static string Test() { ...

Dependency Property Default Value for Int -Stupid BUG

Saturday, June 20, 2015

Just sharing piece of thinking. In General, ask any programmer around you about the default value of type int. Or simply assign your variable by The most sophisticated way of DotNet.. Int I = default(int); Well, moving on to Dependency Property definition its required from the programmer to declare on default value for instantiation, In case of int it will be something like : public int MyProperty { get { return (int)GetValue(MyPropertyProperty); } set { SetValue(MyPropertyProperty, value); } ...
אין תגובות

AutomationID in CustomControl based string format

Wednesday, June 3, 2015

This common question coming up from time to time in a variety of variations, Today when automation testing is a standard , and we have a resource control in a custom library or in userControl library which use in several cases and by different locations in the same App. Well, if you writing a pay per use control of course you need a professional solution like exposing a dependency property per unit But for a quick solution or adding solution for third party control without the necessary supports you can try this one, as an example have a look on BlogPost i have been...
אין תגובות

Custom Control – Xaml CheckBox to On-Off button

Tuesday, April 21, 2015

.Like the toggle or the checkbox but with much more style ,To reach this look and feel we only need a few lines of Xaml style CheckBox is one of the things that it almost impossible for styling, for example try taking control on a checkbox color.. so, what we have left is to redraw the default template of a checkbox, and it quite ,simple to be honest :So starting with simple control template <Style TargetType="{x:Type CheckBox}"> <Setter Property="Margin" Value="1,0,1,0"/> <Setter Property="Height"...
2 תגובות

ADV. XAML programing part 1 – Tag Element for Binding tricks

Tuesday, March 17, 2015

.Really a powerful and cool feature ..You have a native control, like button, textElement, dataGrid etc Now you like to implement something like decorator pattern to use on the control. You can "Tag" your ..control Meaning, use the property Tag to extend your control and than stick on it an additional properties .from other class Meaning , every Xaml Object has a Datacontext Property, which can be used for DataBinding , we can also trying to invoke things by relative binding technics, but sometimes its not enough, so Tag .property could be a fantastic solution ,The Tag property is part of FrameworkElement class and is from type...
תגובה אחת

Zoom Image Control-Part 2

Monday, February 23, 2015

Now lets try to develop something  more professional, meaning in Control oriented way. So it will be something like this: First describe the Control main Logic, have a Content Prop where the user can bind its Object to .zoom it, have an internal Slider which measuring and rendering this content :So use this class public class SimpleZoomControl : ContentControl { static SimpleZoomControl() { DefaultStyleKeyProperty.OverrideMetadata(typeof(SimpleZoomControl), new FrameworkPropertyMetadata(typeof(SimpleZoomControl))); } public UIElement ZoomContent ...
אין תגובות

Zoom Image Control Part 1

Friday, February 13, 2015

I had to provide my client images zoom control . I decided to take advantage of the opportunity and to share with you the development path. Round tiresome in the network brought me a number of examples , some of which were not accurate at all and some with crazy code snippets included . So as is usually found it is more convenient for me to write from scratch and simplify matters .than embed code alien and confused This is to remind that the development environment Win8 (Win -RT ), including the type of .Control that but not Windows 7 or less .We should first...
אין תגובות