Posts

Donate

'Microsoft.VisualStudio.Editor.Implementation.EditorPackage' package did not load correctly (Visual Studio 2012)

After installing updates for my Windows 8 laptop, I did a restart and opened a Visual Studio 2012 instance. Surprisingly, an error pops-up as stated by the title of this  Post. I did some search on Microsoft Knowledge Base and found a patch for it which is available for download. See the link below: Update for Microsoft Visual Studio 2012 (KB2781514) Greg

CSS Linear Gradients Not Working In Internet Explorer 9 But Working In Firefox And Chrome

Image
I came across with linear gradients not working correctly in IE 9. One solution suggested by a popular forum is to utilize an image as the background of a particular element. Since I'm not a graphic designer, I searched for other solution. I came up with an alternative which is to embed an svg file instead of an image file as an element's background. The css code below won't work in IE 9. body { background-image : -ms-linear-gradient( top , #000, #666); } Here's a solution using .svg file: <svg xmlns= "http://www.w3.org/2000/svg" width= "100%" height= "100%" viewBox= "0 0 1 1" preserveAspectRatio= "none" > <linearGradient id= "g762" gradientUnits= "userSpaceOnUse" x1= "0%" y1= "0%" x2= "0%" y2= "100%" > <stop stop-color= "#000000" offset= "0" /><stop stop-color= "#666666" o

Creating And Consuming Custom Control Events In Windows Forms C#

In my autocomplete textbox control, I have a listbox that shows the suggested items based on user input. However, as a requirement I want to create an event that will trigger once a selection has been done in the listbox and this event will be consumed in the calling program (Main Form). To do that, you must define a custom event. After googling for a while, here are the references that made me accomplish the task: Creating Custom Events in C# Quick and Easy Custom Events Cheers!

Change WPF DataGridCell Background Color Using IVMultiValueConverter

Image
In a post by codefornothing in which He demonstrate the use of IMultiValueConverter using DataTable: The WPF Datagrid and Me , I decided to create a similar post in which the binding source is of type collection (Observable Collection). I encountered a few issues like how to replace the Binding Path values from binding to a strongly type class instead of DataTable. To get things started, here are the snippets: Observable Class public class StudentList : ObservableCollection<Student> { public StudentList() { Add( new Student{ID = 1, Age = 29, Name = "Jerby" , Address= "Cebu" }); Add( new Student{ID = 2, Age = 28, Name = "Renz" , Address= "Cebu" }); Add( new Student{ID = 3, Age = 23, Name = "Aya" , Address= "Leyte" }); Add( new Student{ID = 4, Age = 33, Name = "Jeff" , Address= "Leyte" }); Add( new Student{ID = 5

Change WPF DataGridCell Background Color Using IValueConverter

Image
Here's a solution in painting a specific DataGridCell using IValueConverter. The datagrid set's it's ItemSource property either using List object or Datatable object. Resource markup: <Window.Resources> <src:BorderBrushConverter x:Key= "BorderBrushConverter" /> </Window.Resources> XAML markup: <DataGrid AutoGenerateColumns= "False" CanUserAddRows= "False" Grid.Row= "2" Grid.Column= "0" Name= "dgStudents1" > <DataGrid.Columns> <DataGridTextColumn Header= "ID" Binding= "{Binding Path=ID}" Width= "120" IsReadOnly= "True" /> <DataGridTextColumn Header= "Age" Binding= "{Binding Path=Age}" MinWidth= "100" IsReadOnly= "True" > <DataGridTextColumn.CellStyle> <Style TargetType= "DataGridCell"

Change WPF DataGridRow Background Color Using IValueConverter

Image
There are several ways in painting a wpf datagrid. One option would be to use the IValueConverter interface. Firstly, you have to define a class that implements the interface. And add contracts to Convert() and ConvertBack() methods. Assuming in your form load, you bind a List object to the datagrid's ItemSource property. T could be a pre-defined class. Here's the Resource code: <Window.Resources> <src:AgeTargetConverter x:Key= "AgeTargetConverter" /> </Window.Resources> Here's the XAML markup: <DataGrid Grid.Row= "0" Grid.Column= "0" AutoGenerateColumns= "False" CanUserAddRows= "False" Name= "dgStudents" > <DataGrid.RowStyle> <Style TargetType= "{x:Type DataGridRow}" > <Style.Triggers> <DataTrigger Binding= "{Binding Age, Converter={StaticResource AgeTargetConverter}, ConverterP

Windows Forms Fire TextBox Control Events Defined In A User Cntrol From Main Form

In a scenario where in I have created a user control which has a textbox control with private keypress event. I drag and drop the user control to my main form and then I want to fire the keypress event defined in the user control. Assuming in my main form I have this code: private void customTextBox1_KeyPress_1( object sender, KeyPressEventArgs e) { //accept letters,numbers, spacebar and backspace key if ( char .IsLetterOrDigit(e.KeyChar) || e.KeyChar == '\b' || e.KeyChar == ( char )Keys.Space) { e.Handled = false ; } else { e.Handled = true ; } } Note: customTextBox1 is the user control name and customTextBox1_KeyPress_1 is the user control keypress event. In order to trigger the keypress event of the textbox defined in the user control, call Keypress user control in the textbox keypress event handler. See code below: private void textBox1_KeyPress( object sende

Apply Drop Shadow Effect To Text Using CSS (Cross Browser Compatibility Issue)

Image
Out of boredom, I tried manipulating the drop shadow effect of text in a simple html file. The browsers tested where IE 9, Firefox 12 and Chrome version 32.However, I found some difficulties on controlling the drop shadow effect in IE 9. After doing some research, I found a solution using filter. Here's my simple html markup: <!DOCTYPE html> <html> <head> <meta charset= "utf-8" /> <title>Chapter 2: Drop shadows on text</title> <link rel= "stylesheet" href= "textshadowGreg.css" /> <!-- http://reference.sitepoint.com/css/conditionalcomments --> <!--[if IE ]> <link href="textshadowIE.css" rel="stylesheet" type="text/css"> <![endif]--> </head> <body> <h1>What is CSS?</h1> <p> Cascading Style Sheets (CSS) is a style sheet language used for de

CSS Pseudo Element Selector ::first-letter Not Working On Mozilla Firefox

I have a css and html markup below using ::first-letter selector. The markup below works in Google Chrome and Internet Explorer which changes the font size, weight and color properties of the first letter but not on Mozilla Firefox. .fourthwrapper ::first-letter { font-size : 200%; font-weight : bold ; color :brown; } <div class= "fourthwrapper" > <p> This is some text within a div with a class of wrapper. </p> </div> The solution would be to change the css code to specify that the first letter of the paragraph should be modified. .fourthwrapper p::first-letter { font-size : 200%; font-weight : bold ; color :brown; }

Custom CheckedListBox DataGridView Column

Image
Here's a working custom control class on how to embed CheckedListBox as a datagridview column. Source: Need a DataGridView Custom Column of Type ListView or CheckedListBox However, this class lacked functionalities such as obtaining the checked items and preserving the checked items during painting of the datagridview cell. Here's the custom class: public class CheckedListBoxColumn : DataGridViewColumn { public CheckedListBoxColumn() : base ( new CheckedListBoxCell()) { } public override DataGridViewCell CellTemplate { get { return base .CellTemplate; } set { if ( value != null && ! value .GetType().IsAssignableFrom( typeof (CheckedListBoxCell))) { throw new InvalidCastException( "Must be a Checke

Donate