Certain times we get an error while attaching an mdf file saying,
“The file “D:DataBaseFile.mdf” is compressed but does not reside in a read-only database or filegroup. The file must be decompressed.
Could not open new database ‘D:DataBaseFile.mdf’. CREATE DATABASE is aborted.”
Think in the lines of Parental control application where we need to block certain websites from being accessed. To make it harder, this will be a Windows application where user can configure the sites to be blocked and unblocked.
Let’s start thinking of what we can do to achieve this.
In normal case we generally add our controls to the WPF Grid in XAML setting the Row and Column value. If you want to add a control to the Grid at runtime from Code-behind, the way to do it will be,
This article discusses and demonstrates the implementation of a trigger in WPF which has multiple conditions.
Triggers in WPF are very important and handy features. Triggers and styles add to WPF’s bag a rich set of functionality. Triggers are like event handlers which we define in XAML’s DateTemplates and styles.Triggers allow us to define several Setter elements in a style. The trigger includes a condition, and when that condition is true, the Setters defined in the trigger will be applied. When the condition is false, the Setters are ignored.
Here is a sample trigger,
< Style.Triggers > < Trigger Property="IsEnabled" Value="False" > < Setter Property="Visibility" Value="Collapsed" / > < /Trigger > < /Style.Triggers >
The above example demonstrates a Style trigger which fires when the IsEnabled property is false. The resulting controls Visibility property will be set to Collapsed.
Moving ahead, what if our condition is based on multiple criteria? Here comes the use of MultiTriggers.
Here is a sample Multi-Trigger,
< MultiTrigger > < MultiTrigger.Conditions > < Condition Property="Content" Value="a" / > < Condition Property="IsMouseOver" Value="True" / > < /MultiTrigger.Conditions > < Setter Property="Visibility" Value="Collapsed" / > < /MultiTrigger >
The above trigger will fire when Content has a value of “a” and mouse is over the control.
This article discusses the WPF DispatcherTimer.
Most of us are from a background of C# (or VB.Net). You must have some point of time come across a scenario for performing a repetitive GUI operation after certain period of time. The solution in most cases has been the WinForm’s Timer.
What about WPF ? Does it have a Timer ?
There is a cool list of MetaData functions present in SQL server. I will be discussing one of them – object_id
Often we need to check if the Database is present and if it not then we need to create a new one. The most common answer to this is, try to connect to the Db and if the connection fails/throws an exception then the database does not exist. Do you think it is correct ?