3월, 2014의 게시물 표시

Expression tree vs Reflection

http://stackoverflow.com/questions/4803272/in-c-is-expression-api-better-than-reflection

WebBrowser Control Wrapper

http://www.codeproject.com/Articles/555302/A-better-WPF-Browser-Control-IE-Wrapper

dynamic object serializing

http://www.codeproject.com/Articles/62839/Adventures-with-C-dynamic-ExpandoObject-Elasti http://stackoverflow.com/questions/3055461/dynamic-object-serialization http://msdn.microsoft.com/en-us/library/system.dynamic.expandoobject(v=vs.100).aspx

Visual Studio execution error - can't find module.

1. Reinstall Visual Studio 2. If it's not working, reinstall the .NET Framework.

COM Interop에서 dynamic의 적절한 사용

From C# 4.0, variant types are instead mapped to dynamic (if Embed Interop Types is enabled; more on this soon), allowing you to replace the last two lines with this: excel.Cells [1, 1].Font.FontStyle = "Bold"; The disadvantage of working in this way is that you lose auto-completion, so you must know that a property called Font happens to exist. For this reason, it’s usually easier to dynamically assign the result to its known interop type: Excel.Range range = excel.Cells [1, 1]; range.Font.FontStyle = "Bold"; As you can see, this saves only five characters over the old-fashioned approach!

(IDispatch) COM 객체의 타입명 찾기.

Microsoft.VisualBasic.Information.TypeName(XXX) 개같은 COM Interop

Set rendering mode to ie9 when using webbrowser control.

http://stackoverflow.com/a/6770294

Why The Command?

이미지

Disabling a control to have built-in command support

Ideally, the control will provide a property that allows you to gracefully switch off the command support. This ensures that the control will remove the feature and adjust itself consistently. For example, the TextBox control provides an IsUndoEnabled property that you can set to false to prevent the Undo feature. (If IsUndoEnabled is true, the Ctrl+Z keystroke triggers it.) If that fails, you can add a new binding for the command you want to disable. This binding can then supply a new CanExecute event handler that always responds false. The final option is to remove the input that triggers the command by using the InputBindings collections. For example, you could disable the Ctrl+C keystroke that triggers the Copy command in a TextBox by using code like this: KeyBinding keyBinding = new KeyBinding(ApplicationCommands.NotACommand, Key.C, ModifierKeys.Control); txt.InputBindings.Add(keyBinding);

FocusManager

This example has an interesting detail. The Cut, Copy, and Paste commands are handled by the text box that has focus. However, the command is triggered by the button in the toolbar, which is a completely separate element. In this example, this process works seamlessly because the button is placed in a toolbar, and the ToolBar class includes some built-in magic that dynamically sets the CommandTarget property of its children to the control that currently has focus. (Technically, the ToolBar looks at the parent, which is the window, and finds the most recently focused control in that context, which is the text box. The ToolBar has a separate focus scope, and in that context, the button is focused.) If you place your buttons in a different container (other than a ToolBar or Menu), you won’t have this benefit. That means your buttons won’t work unless you set the CommandTarget property manually. To do so, you must use a binding expression that names the target element. For example, if the...

MVVM Light 설치

PM> Install-Package MvvmLight

Data Conversion in Binding

StringFormat 속성 .NET 기본 포맷 문자열 사용 입력값이 여러 개면 MultiBinding 을 사용. Value Converter IValueConverter  나  IMultiValueConverter  를 구현한다. 그리고 Attribute에 소스와 타겥 타입을 지정하고, XAML에 리소스에 포함해서 사용. 파워풀하네~.