WPF DatePicker presented text internal bug

Thursday, May 18, 2017

WPF Datepicker shows text before any date selected and that ‘Select a Date’ Now, if you working with custom template or other language or whatever, You can do that while overwriting the Control template, Than it founds interesting unit called PART_TextBox of type > DatePickerTextBox Well, this control present the selected Date as a Text, and whatever you will set in this section of template will be the startup text instead of ‘Select a Date’ like ‘peek some date’ The problem is, lets say you set any date than you want to reset your Form, I mean to return this control to its original...
אין תגובות

WPF performance checklist

Thursday, March 30, 2017

Actually I am not using WPF so much those days, but as a guide at community workshop it came out and I promised to publish those conclusions out, so here we go.. and it is dedicated to you fellows .. Here is list of goodies: 1. Here is some gold rules can boost your app without great effort. 2. Remember Xaml item is a Class instance. 3. Since WPF use smart dependency property, ask yourself if every property you just seeing on your xaml file is really necessary. It specially critical while talking about Designer’s code or generated Xaml code. 4. Minimize the...
אין תגובות

Xaml default background and transparent background

Sunday, November 6, 2016

Xaml  default background and transparent background This post will guide you to the internal rendering brush mechanism with interaction between elements on the element visual tree, could also be relevant to solve UI bugs on xaml code, (which are not bugs in simple meaner, only misunderstanding of the platform) 1.    While debugging an visual tree of custom control template you might find elements with Background =””. In most of cases it will not harm your application, But can also be effected in user actions. 2.    Observe this code: <Style x:Key="listItem" TargetType="{x:Type ListBoxItem}"> <Setter Property="Template"> ...
אין תגובות

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

MVVM View first VS. ViewModel first

Monday, January 25, 2016

Since early times UI developers has merchandise with the purpose of MVVM It is hard to judge what is better way to develop with,  in this post I will try to demonstrate they both,  and compare a little but definitely not to have a statement of what is right, -  The term of ViewModel evolution 1: Is it a Model translation for presentation layer, So when we writing this ViewModel class we actually relay either on a real model like  a physical entity or virtual one like other class  -  The term of ViewModel evolution 2: In MVVM CodeBehind is prohibited, there for every reaction for...
אין תגובות

Follow Xaml code Order or don’t be there

Monday, December 7, 2015

Sometimes you surprised from tiny things around you day who might taking you out of control. For example the Order of the Xaml elements on your sheet. The famous one is probably using a source who defined later, like: <DataTemplate x:Key="dt1"> <Grid> <Button Style="{StaticResource style2}" /> </Grid> </DataTemplate> <Style TargetType="Button" x:Key="style2"> In this case there is some...
אין תגובות

Cancel Selcted Event but invoke the Command

Tuesday, November 10, 2015

The challenge  here is relevant for several scenarios, like validation , hooking, etc. when pressing on a button we can invoke the bind command but ignore the selection event, while doing it in a attach property like this one we can keep the MVVM pattern clean . the command is actually get fired ,but the button stays calm. It is also usable in every other control who let us fire the command on mouse enter like in interactions-trigger but block the other items in the chain. public static class CancelClickAction { public static readonly DependencyProperty OnClickProperty =...
אין תגובות

Attached Property – select all text

Tuesday, October 27, 2015

in TextBox control double clicking on Text should select all inner text? Well isn't? not for case the text itself is a complex one, like real number like : 23.34 In that case , it will select but only the part you on it, at least by default What we need now is activate the TextBoxBase.Selectall function but using WPF tools and supporting MVVM architecture. The simple solution will be Attached Property or Behavior , I think that Behavior should kept for complex problems when we do need a reference per control instance , and here a simple static property should be enough. There for...
אין תגובות

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