1월, 2014의 게시물 표시

Which layout control is appropriate?

You can create almost any interface by using nested Grid containers. (One exception is wrapped rows or columns that use the WrapPanel.) However, when you’re dealing with small sections of user interface or laying out a small number of elements, it’s often simpler to use the more specialized StackPanel and DockPanel containers. A good rule of thumb is to use smaller layout containers such as the StackPanel for one-off layout tasks, such as arranging a group of buttons. On the other hand, if you need to apply a consistent structure to more than one area of your window, the Grid is an indispensable tool for standardizing your layout.

A few key principles when arranging elements.

Elements (such as controls) should not be explicitly sized. Instead, they grow to fit their content. For example, a button expands as you add more text. You can limit controls to acceptable sizes by setting a maximum and minimum size. Elements do not indicate their position with screen coordinates. Instead, they are arranged by their container based on their size, order, and (optionally) other information that’s specific to the layout container. If you need to add whitespace between elements, you use the Margin property. Layout containers “share” the available space among their children.They attempt to give each element its preferred size (based on its content) if the space is available. They can also distribute extra space to one or more children. Layout containers can be nested.A typical user interface begins with the Grid, WPF’s most capable container, and contains other layout containers that arrange smaller groups of elements, such as captioned text boxes, items in a list, ic...

The Best Books about WPF

WPF 4.5 Unleashed by Adam Nathan (Aug 9, 2013) Pro WPF 4.5 in C#: Windows Presentation Foundation in .NET 4.5 by Matthew MacDonald (Nov 20, 2012)

매우 실용적인 XAML 정의

XAML (short for Extensible Application Markup) is  a markup language used to instantiate .NET objects. 오~~~. 이 얼마나 깔끔한 설명인가. You need to understand rules: Every element in a XAML document maps to an instance of a .NET class. The name of the element matches the name of the class exactly. For example, the element <Button instructs WPF to create a Button object. As with any XML document, you can nest one element inside another. As you’ll see, XAML gives every class the flexibility to decide how it handles this situation. However, nesting is usually a way to express containment—in other words, if you find a Button element inside a Grid element, your user interface probably includes a grid that contains a button inside. You can set the properties of each class through attributes. However, in some situations, an attribute isn’t powerful enough to handle the job. In these cases, you’ll use nested tags with a special syntax.

디자인 타임에 파일 생성하기.

Design-Time Code Generation by using T4 Text Templates 주로 소스 코드 파일을 생성하는데  쓰이겠지.

런타임에 문자와 같은 리소스 생성.

Run-Time Text Generation with T4 Text Templates 런타임에 매우 큰 문자열과 같은 리소스를 동적으로 생성해야 할 경우, 리소스 생성을 소스 파일에서 할 수도 있지만, T4 Text Template을 이용하면 소스에서 분리할 수 있다.

무료(?) UML 도구.

정말 UML 도구 만큼은 공짜 프로그램들 중에는 쓸만한 것이 거의 없다. http://www.visual-paradigm.com/product/vpuml/features/umlmodeling.jsp 의 Community Edition이 있는데, 상업적인 목적으로는 쓸 수 없고, 대신 월 사용료 형태로 쓰면 생각보단 저렴하네. 하지만 UML다이어그램만 그릴 목적이라면 월 $5의 Modeler 도 좋아 보인다.

Oracle Sql Developer. 쓸만한 무료 ERD 도구.

이미지
좋으면서도 무료인 ERD 도구 하나 없는 것이 매우 슬프나, Oracle Sql Developer 를 MS-SQL 에 연결해서 쓰면 나름 괜찮다. 무료 ERD 도구 중엔 젤 좋은 프로그램. http://kentgraziano.com/2013/01/14/tech-tip-connect-to-sql-server-using-oracle-sql-developer/ http://www.oracle-base.com/blog/2013/10/01/sql-developer-4-ea2-connecting-to-sql-server/ 설치하고 나서 JDBC  드라이버를 설치한다.  다운받은 드라이버를 적당한 곳에 풀고,  환경설정 > 데이터베이스 > 타사 JDBC 드라이버 메뉴에서 jtds-1.3.1.jar 파일을 선택. 프로그램 재실행하면 연결 추가에 SQL  Server 탭이 추가된다. SSO 연결 오류에 관한 건 구글링.

XPath

http://www.w3schools.com/xpath/xpath_syntax.asp 언제나 간단한 것이 좋은 것.

Html Agility Pack. HTML Parser.

This is an agile HTML parser that builds a read/write DOM and supports plain XPATH or XSLT. http://htmlagilitypack.codeplex.com/

The Role of the {TemplateBinding} Markup Extension

TemplateBinding Markup Extension links the value of a property in a control template to be the value of a property on the templated control.

Understanding Routed Events

Thankfully, WPF routed events take care of ensuring that your single Click event handler will be called regardless of which part of the button is clicked automatically. Simply put, the routed events model automatically propagates an event up (or down) a tree of objects, looking for an appropriate handler. Specifically speaking, a routed event can make use of three routing strategies. If an event is moving from the point of origin up to other defining scopes within the object tree, the event is said to be a bubbling event . Conversely, if an event is moving from the outermost element (e.g., a Window) down to the point of origin, the event is said to be a tunneling event . Finally, if an event is raised and handled only by the originating element (which is what could be described as a normal CLR event), it is said to be a direct event.

Understanding the Role of Dependency Properties

Dependency Properties Overview Given all of these similarities, why does WPF define a new term for such a familiar concept? The answer lies in how a dependency property is implemented within the class. You’ll see a coding example in just a little bit; however, from a high level, all dependency properties are created in the following manner: First, the class that defined a dependency property must have DependencyObject in its inheritance chain.  A single dependency property is represented as a public, static, read-only field in the class of type DependencyProperty. By convention, this field is named by suffixing the word Property to the name of the CLR wrapper (see final bullet point).  The DependencyProperty variable is registered via a static call to DependencyProperty.Register(), which typically occurs in a static constructor or inline when the variable is declared.  Finally, the class will define a XAML-friendly CLR property, which makes calls to methods provide...

WPF Resources

The logical resource (also known as an object resource) system is a way to name and refer to commonly used objects within a WPF application. While logical resources are often authored in XAML, they can also be defined in procedural code. WPF supports two flavors of resources. The first is a binary resource ,and this category typically includes items most programmers consider a resource in the traditional sense (embedded image files or sound clips, icons used by the application, and so on). The second flavor, termed object resources or logical resources , represents a named .NET object that can be packaged and reused throughout the application. While any .NET object can be packaged as an object resource, logical resources are particularly helpful when working with graphical data of any sort, given that you can define commonly used graphic primitives (brushes, pens, animations, etc.) and refer to them when required. How to allocate resources are Window-Wide Resources : in each xa...

WPF Graphics Rendering Services - Drawing

이미지
WPF provides the Drawing that is a sophisticated drawing and geometry programming interface that renders even more lightweight 2D vector images. DrawingGroup  GeometryDrawing  GlyphRunDrawing  ImageDrawing VideoDrawing Because they are more lightweight, Drawing-derived types do not have intrinsic support for handling input events, as they are not UIElementsor FrameworkElements(although it is possible to programmatically perform hit-testing logic). Another key difference between Drawing-derived types and Shape-derived types is that Drawing derived types have no ability to render themselves, as they do not derive from UIElement! Rather, derived types must be placed within a hosting object (specifically, DrawingImage, DrawingBrush, or DrawingVisual) to display their content.

WPF Graphics Rendering Services - Shape

이미지
Members of the System.Windows.Shapes namespace provide the most straightforward, most interactive, yet most memory-intensive way to render a two-dimensional image. This namespace (defined in the PresentationFramework.dll assembly) is quite small and consists of only six sealed classes that extend the abstract Shape  base class: Ellipse Rectangle Line Polygon Polyline Path : provides the ability to define complex 2D graphical data represented as a collection of independent geometries. LineGeometry  RectangleGeometry  EllipseGeometry  GeometryGroup  CombinedGeometry  PathGeometry

WPF Brushes and Pens

Brush This allow you to control how the interior of a 2D surface is filled. DrawingBrush ImageBrush LinearGradientBrush RadialGradientBrush SolidColorBrush VisualBrush Pen This is an object for drawing borders of geometries, or in the case of the Line or PolyLine class, the line geometry itself. Specifically, the Pen class allows you to draw a specified thickness, represented by a double value.

WPF Graphical Rendering Options

WPF uses a particular flavor of graphical rendering that goes by the term retained-mode graphics .Simply put, this means that as you are using XAML or procedural code to generate graphical renderings, it is the responsibility of WPF to persist these visual items and ensure they are correctly redrawn and refreshed in an optimal manner. Thus, when you render graphical data, it is always present, even when the end user hides the image by resizing or minimizing the window, by covering the window with another, and so forth. In stark contrast, previous Microsoft graphical rendering APIs (including Windows Form’s GDI+) were immediate-mode graphical systems. In this model, it was up to the programmer to ensure that rendered visuals were correctly “remembered” and updated during the life of the application. For example, in a Windows Forms application, rendering a shape such as a rectangle involved handling the Paintevent (or overriding the virtual OnPaint()method), obtaining a Graphics object...

Visual Studio 인텔리센스 제시 목록에서 고를 때 방향키 대신에 I-J-K-L 키 사용하기.

오른손이 방향키로 갔다 오는 것이 너무 불편해서  찾아 봤더니... https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2634993-give-an-alternative-to-the-arrow-keys-when-using-i  에서  http://touchcursor.sourceforge.net/  를 추천하는데 괜찮네.

GridView에서 여러 줄로 된 헤더 만들기.

http://stackoverflow.com/questions/18327749/how-to-add-header-and-subheader-in-gridview 참 쉽죠잉~.

Core WPF Assemblies.

PresentationCore.dll This assembly defines numerous namespaces that constitute the foundation of the WPF GUI layer. For example, this assembly contains support for the WPF Ink API (for programming against stylus input for Pocket PCs and Tablet PCs), animation primitives, and numerous graphical rendering types. PresentationFramework.dll This assembly contains a majority of the WPF controls, the Application and Window classes, support for interactive 2D graphics and numerous types used in data binding. System.Xaml.dll This assembly provides namespaces that allow you to program against a XAML document at runtime. By and large, this library is only useful if you are authoring WPF support tools or need absolute control over XAML at runtime. WindowBase.dll This assembly defines types that constitute the infrastructure of the WPF API, including those representing WPF threading types, security types, various type converters, and support for dependency properties and routed ...

SQL. Pivoting에 대한 가장 깔끔한 설명

http://www.codeproject.com/Articles/692269/Querying-SQL-Server-2012-Part-II

프로그램은 AppDomain이 호스팅한다. Process가 직접 하지 않는다.

이미지
Under the .NET platform, executables are not hosted directly within a Windows process , as is the case in traditional unmanaged applications. Rather, a .NET executable is hosted by a logical partition within a process termed an application domain. It is important to point out that the CLR does not permit unloading individual .NET assemblies . However, using the AppDomain.Unload()method, you are able to selectively unload a given application domain from its hosting process.