Using Smart CLR Property as object repository

Sunday, December 4, 2016

the next scenario can be Simple, yet during development it is hard to change design so tricks like that can be awesome. Consider the following entity. public class Cat { public string Name; } public class Dog { public string Name; } class Wrapper { public bool isDog; private Dog dog = new Dog() {Name = "Snoopi" }; private Cat cat = new Cat() {Name = "Tom" }; public string Name { get { ...

UWP – when Build failed on different computers

Tuesday, October 25, 2016

An important Deployment action. You worked at the office on universal apps application, You take the code with you as whole solution to continue at home. While trying opening the solution its ok, also build action its ok even rebuild action.. Only when try to debug the project (F5) you might face of with annoying evil. Something like : Registration of the app failed. Another user has already installed an unpackaged version of this app. The current user cannot replace this with a packaged version. The conflicting package is {some Guid} Well it simple in universal apps there is underline deployment session, Every project has  a manifest...
אין תגובות

UWP Win10 – introduction to page navigation.

Wednesday, September 28, 2016

The Application block of Win10 app constructed as following: Application > Window > Frame > Page While this page  can be any page you like. Commonly use pattern is leave the main page as container and inside it use internal page as Content place holder. Lets build the solution files than continue on navigation implementation. I simply create solution folder named Pages with some pages inside, Now lets build the MainPage xaml: <Grid Background="LightCyan"> <Grid.RowDefinitions> <RowDefinition Height="1*"/> ...
אין תגובות

Cropping image part form main image using Bitmap

Friday, June 10, 2016

It might be sound as complex work but it is actually an simple one, The shortest implementation is based on Bitmap framework of System.Windows.Media.Imaging, The first part of the challenge is to select a rectangle or something similar to be used as desired area of the cropped image, but selection itself is another discussion.. as for now assume you have an well defined box, every task of cropping inage part based on X location Y location Width and Height. In reality, after you get the right coordinates you just need to activate the next fancy cropping service: /// crop image part based on...
תגובה אחת

TemplateBinding and TemplateParent Digging

Monday, May 9, 2016

One of the things that can completely freak you out. Lets start with facts: 1.  While customize an application you might use something like this: <TextBlock Text="{Binding RelativeSource={RelativeSource TemplatedParent},Path=MyProperty}"/> Or maybe this: <TextBlock Text="{TemplateBinding MyProperty}" /> While this is on the ResourceDictionary of your app and about to styling your custom control, and MyProperty is an DependencyProperty on the logic part of the Control so what the different between those two?  And what the default choose should be? By the way while most of programmers used to write You can use the Short way as: Text="{Binding TemplatedParent.MyProperty2}" 2.    A full demonstration will be like  this one: public class CustomControl1 : Control ...
אין תגובות

Prism 6 from ground up by 10 minutes

Sunday, April 3, 2016

In this post we will build a small app using Prism 6 and Unity together with all necessary  tools. One of the commonly known issues  with Prism is the different between versions and dlls. So I choose in the demo to use the last nugget package and to trust it. Than to manipulate all around it, Well surprising way, installing unity for Prism 6 was include automatically all Prism 6 dependencies which reduce any computability  issues Well, Prism architecture is simple, A. We have Shell which is the main window and probably the only window in the application. B. We have Regions inside the Shel and they would...

Customize Window header Style

Thursday, March 10, 2016

In case you demand some extras from your MainWindow as programs like Microsoft Office did, Lets say extra icons, menus , buttons or whatever. The built in Window of System.Window type and its API in Xaml is very uncomfortable for customization and guess what , you the one who need to do all the dirty work. All of it? well I gonna help you to how to start. In this screen shot I have, 1 . Icon on left (standard) 2. App name at left (standard) 3.  details on center (extra) 4. app special menu at right (extra) 5. window buttons at left (kind of standard) So, first...
אין תגובות

#Create an HTML doc from C

Thursday, January 14, 2016

Sometimes on server side we need to draw some reports to our domain folder, If we already inside dotnet area  we can simplify the process with simple dotnet framework. Using HtmlTextWriter can do the work and very easily , just assume that you know something or two about html, and the hierarchical structure of it,  than  you can continue from this struct to develop any webpage you need, start html tag , header body etc, of course can insert any css or js references, Just do not forget to close any opened tags, so as a demo : private static string lines...
אין תגובות

WPF Custom Controls – toggle buttons with Group

Sunday, October 4, 2015

The idea is quite simple , create header of ListBox who combine two types of contents, to be acting like an tab control , meaning filtering the Listbox content, and So , for implementation we can considerate a few options, Tabcontrol , RadioButtons , Toggle Button etc.. Just for the fun I have made it with toggles, the truth is I where must use them because of look an fill demands and styling but this is not the point, The point is what between RadioButton control and ToggleButton control, the main issue is the group who might surround the radio buttons and auto switch...
אין תגובות

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...
אין תגובות