This version of the page http://lvivcommunity.net/?tag=/en (0.0.0.0) stored by archive.org.ua. It represents a snapshot of the page as of 2008-06-11. The original page over time could change.
Lviv .NET Community - All posts tagged 'en'
(Lviv community of .NET developers)
Home News
  • Archive
  • About
  • Conferences
  • |  
  • Sign in / Register

Recent posts

Можливості використання класу DataTemplateSelector - Correct use DataTemplateSelector

сентября 4, 2007 04:30 by RredCat
В багатьох класах, що наслідуються від FrameworkElement є така корисна пропертя як *TemplateSelector типу DataTemplateSelector. В неї можна підставити свій клас, що наслідується від DataTemplateSelector і переписати метод SelectTemplate(). Це дозволить на ходу генерувати темпліти для контенту елемента. Дані в цей метод можна отримати елементарними біндігами. А тепер особливість: можна писати всі біндігни (навіть ті що посилаються на ElementName), крім TemplateBinding, тобто щоб RelativSourceMode не був рівний TemplatedParent.

In the many inherited from FrameworkElement contain a useful dependency property *TemplateSelector type of DataTemplateSelector. It can set our inherit from DataTemplateSelector class and override the method SelectTemplate(). This allow dynamic generate template for a content. Content-data we can get a elementary binding. And now feature: we can use all binding (even that what refet to ElementName), except TemplateBinding, therefore RelativSourceMode doesn't equal TemplatedParent.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags: datatemplateselector, template, wpf, ua, en
Categories: .NET | WinFx
Actions: Permalink | Comments (0) | RSS

Кастомізація стилів в класах наслідуваних від класу Selector - Custom style for a class which is inherited from the class of Selector

августа 16, 2007 09:21 by RredCat

Нам потрібно виставити свої стилі і шаблони для для елементів, якими наповнюються контроли наслідувані від абстрактного класу Selector (до них належить стандартні ComboBox, ListBox, TabControl).
Це можна зробити двома шляхами.
1) В ресурси самого контрола внести стилі і шаблони айтемів. Це трохи незручно. З цих стилів і шаблонів нічого не можна буде "побачити" за межами ресурсів "батьківського" контрола.
2) Використати віднаслідувану від Selector`a пропертю ItemContainerStyle - внести в неї значення по ключу статичного ресурса.

PS: Зручність другого способу особливо помітна при написанні контролів, коли для кастомізації айтема потрібна інфа з-за меж "батьківського" ресурсу.


We need set own custom style or template for item of control which was inheritance from abstract class 'Selector' (for example: ComboBox, ListBox, TabControl)
We can use two way:
1) We can add in control's resource some style and template. But it isn't good way, because these styles and templates have access only in boundary of control.
2) We can use inheritance from Selector ItemContainerStyle dependency property and set in it new style value.

Currently rated 5,0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags: custom style, style, template, wpf, ua, en
Categories:
Actions: Permalink | Comments (0) | RSS

Надійна робота MultiData тригерів - Correct works of MultiDataTrigger

августа 16, 2007 06:20 by RredCat
Іноді нам доводиться використовувати кілька малті дата трігерів, де один із біндінгів у всіх трігерах одинаковий. Як показує практика краще його писати останнім в списку біндінгів, в іншому випадку він не завжди спрацьовує. Для іниших видів малті трігерів вище написане не перевірялось, хоча навряд відрізняєтсья..

Sometimes we will be use a few MultiDataTrigger and them contain one identical binding. As practice shows better way is write identical binding to last in the list of condition, in other case MultiDataTrigger works not always. For the other types of MultiTriggers the it was unchecked, although scarcely it isn't identical..

Currently rated 5,0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags: multidatatrigger, wpf, ua, en
Categories:
Actions: Permalink | Comments (1) | RSS

Обхідний маневр при заміщенні кольорів в контролі - "Cruel" colors substitution

августа 15, 2007 22:22 by RredCat

Іноді виникає потреба покастомайзити один чи кілька кольорів контролу. За умови, що шаблон недоступний (чи тяжко доступний) і якщо там використовуються сисетмні кольори, для кастомізації можна застосувати такий "обхідний маневр". Приклад для ліст-бокса.


Sometime we need custom one or more brush of control. If template is not available and in base template used system brush, we can use this workaround (example for ListBox):


<ListBox>
  <ListBox.Resources>
    <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="Maroon" />
    <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Maroon" />
    <SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="White" />
    <SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="White" />
  </ListBox.Resources>
  <ListBoxItem>blah-blah</ListBoxItem>
  <ListBoxItem>blah-blah</ListBoxItem>
  <ListBoxItem>blah-blah</ListBoxItem>
</ListBox>



Currently rated 5,0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Tags: custom brush, wpf, ua, en
Categories: WinFx
Actions: Permalink | Comments (1) | RSS