Pages

Showing posts with label Items. Show all posts
Showing posts with label Items. Show all posts

Friday, August 5, 2011

Paul Costelloe Pop up shop in John Lewis - EXCLUSIVE Catwalk Items

For two weeks from 18th February 2011, Paul Costelloe Man will be offering the chance to own exclusive pieces from the Paul Costelloe Man catwalk collection in conjunction with John Lewis. Launching directly after Paul Costelloe’s opening show at London Fashion Week, Paul Costelloe will be in attendance to open an exclusive pop up shop in John Lewis’ flagship, Oxford Street store.

The pop up will be the first John Lewis has ever installed and will showcase the capsule collection with unique branding, visuals and an Oxford Street window. The first collection of it’s kind, the Costelloe Catwalk collection is a 25 piece capsule of garments from the SS11 Paul Costelloe Man catwalk show that opened London Fashion Week for the SS11 season.

Comprising of 4 ties, 2 bow ties, 6 shirts, 2 suits, 2 trousers, 4 shorts, 2 jackets and 3 coats, only 10 pieces of each garment will be available across a selected size range. These will be the only 10 ever to be made worldwide and each will be individually numbered 1 to 10, so every customer will know they own a unique item never to be reproduced.

Drawing its inspiration from many sources and concentrated around a defined palette of deep indigo blue, crisp white, silver and highlights of fiery red; the collection will mark the launch of Spring/Summer 2011 and celebrate Paul Costelloe’s long standing position with the inaugural show of London Fashion Week

Thursday, August 4, 2011

How to link items to a UserControl - WPF

In this article we will see how to perform the binding controls within a UserControl to a WPF application.

And accomplish this task using:
  • The DataContext property of the user control.

Reviewing concepts

A UserControl is a control created from existing controls, adding these controls into a single control in order to optimize your code. It is indicated when you realize that there is a loop in the structure of which involved controls so that if you create a composite control, these controls with the data manipulation is facilitated.

Note: Do not confuse a User Control with a Custom Control in WPF. A Custom Control is a control derived from other control and is used when you create a control from the existing one to include a feature that has no existing control.

After the user control is created to use it just do the following:
  • Include a reference to the namespace of the user control, (and if the user control assembly is not in the same assembly);

  • Include the XAML control in the window where we want to use it.

We will see how to perform data binding to a ListBox control used on a UserControl.

Creating a WPF application

Open Visual Basic 2010 Express Edition and create a new application type WPF Application with the name UserControl_Binding.


On the Project menu, click Add New Item and select the template User Control (WPF), then enter the name macLista.xaml.


Note that the model exists Custom Control (WPF) which is different from User Control (WPF).

Then set the following XAML code for this user control that we create:

Download code now (notepad 4kb)

We define a user control with two first ListBox where the Listbox has the property ItemsSource linked to the current DataContext. Specifying Path =. is used to link to the source of current. Specify the Path =. is not required, can also be written like this: ItemsSource = "{Binding}".

The second ListBox gets ItemsSource MeuItemsSource dependency property. ItemsSource Since this property is linked to user control, you must specify the element whose property is linked to the listbox, then we have this way: ElementName = meuUserControl.

The layout of the ListBox control displays two and can be seen below: (Below is the XAML code).



Linking items to the UserControl in our application

Let us now use the UserControl macListBox we create in our application.

Open the file and the XAML code MainWindow.xaml will include the following statements:

Download your code now (notepad 1kb)

As shown below, we see the result of the inclusion of two lines of XAML code above:


Let us now define the file MainWindow.xaml code to use the user control and perform linking of items in the ListBox control.

Change the code MainWindow.xaml XAML file as shown below:


 Now all we have to do and set the data source file MainWindow.xaml.vb as the code below:

Imports System.Collections 
Imports System.Windows
Public Class MainWindow

Private _testaLista The List (Of String)

Public ReadOnly Property TestaLista () As List (Of String)
Get
If _testaLista Is Nothing Then
start ()
End If
Return _testaLista
End Get
End Property

Private Sub start ()
_testaLista = New List (Of String) ()
_testaLista.Add ("Jose Carlos Macoratti")
_testaLista.Add ("Ana Maria Fonseca.")
_testaLista.Add ("Miriam Estela Ribeiro.")
_testaLista.Add ("Jefferson-Day Andre")
_testaLista.Add ("Janice Rachel Smith.")
_testaLista.Add ("Mario Santos")
_testaLista.Add ("Jessica Lang Lima Bueno")
End Sub

End Class 

When we run the project the following happens:

The first user control in the first TabItem binds to TestaLista DataContext of the window.

After the first listbox in the user control is linked to the DataContext that will show the contents of TestaLista.

The result is shown below:


Although the dependency property defined in MeuItemsSource user control, not used in the example. To do so would have to set the user in control for the dependency property as follows:

Imports System.Collections 
Imports System.Windows
Imports System.Windows.Controls

Partial Public Class macLista
Inherits UserControl

Public Shared ReadOnly MeuItemsSourceProperty The DependencyProperty

Shared Sub New ()
macLista.MeuItemsSourceProperty DependencyProperty.Register =
("MeuItemsSource", GetType (IEnumerable), GetType (macLista))
End Sub

Public Property MeuItemsSource () As IEnumerable
Get
Return DirectCast (GetValue (macLista.MeuItemsSourceProperty), IEnumerable)
End Get
Set (ByVal value As IEnumerable)
SetValue (macLista.MeuItemsSourceProperty, value)
End Set
End Property
Sub New ()
End Sub
End Class

Then just set the file MainWindow.xaml another TabItem defined as follows:

Download your code now (notepad 132bytes)

Thus we show how to perform the binding in controls created by the user.
Get the complete project here: UserControl_Binding.zip


Monday, August 1, 2011

How to link items to a UserControl - WPF

In this article we will see how to perform the binding controls within a UserControl to a WPF application.

And accomplish this task using:
  • The DataContext property of the user control.

Reviewing concepts

A UserControl is a control created from existing controls, adding these controls into a single control in order to optimize your code. It is indicated when you realize that there is a loop in the structure of which involved controls so that if you create a composite control, these controls with the data manipulation is facilitated.

Note: Do not confuse a User Control with a Custom Control in WPF. A Custom Control is a control derived from other control and is used when you create a control from the existing one to include a feature that has no existing control.

After the user control is created to use it just do the following:
  • Include a reference to the namespace of the user control, (and if the user control assembly is not in the same assembly);

  • Include the XAML control in the window where we want to use it.

We will see how to perform data binding to a ListBox control used on a UserControl.

Creating a WPF application

Open Visual Basic 2010 Express Edition and create a new application type WPF Application with the name UserControl_Binding.


On the Project menu, click Add New Item and select the template User Control (WPF), then enter the name macLista.xaml.


Note that the model exists Custom Control (WPF) which is different from User Control (WPF).

Then set the following XAML code for this user control that we create:

Download code now (notepad 4kb)

We define a user control with two first ListBox where the Listbox has the property ItemsSource linked to the current DataContext. Specifying Path =. is used to link to the source of current. Specify the Path =. is not required, can also be written like this: ItemsSource = "{Binding}".

The second ListBox gets ItemsSource MeuItemsSource dependency property. ItemsSource Since this property is linked to user control, you must specify the element whose property is linked to the listbox, then we have this way: ElementName = meuUserControl.

The layout of the ListBox control displays two and can be seen below: (Below is the XAML code).



Linking items to the UserControl in our application

Let us now use the UserControl macListBox we create in our application.

Open the file and the XAML code MainWindow.xaml will include the following statements:

Download your code now (notepad 1kb)

As shown below, we see the result of the inclusion of two lines of XAML code above:


Let us now define the file MainWindow.xaml code to use the user control and perform linking of items in the ListBox control.

Change the code MainWindow.xaml XAML file as shown below:


 Now all we have to do and set the data source file MainWindow.xaml.vb as the code below:

Imports System.Collections 
Imports System.Windows
Public Class MainWindow

Private _testaLista The List (Of String)

Public ReadOnly Property TestaLista () As List (Of String)
Get
If _testaLista Is Nothing Then
start ()
End If
Return _testaLista
End Get
End Property

Private Sub start ()
_testaLista = New List (Of String) ()
_testaLista.Add ("Jose Carlos Macoratti")
_testaLista.Add ("Ana Maria Fonseca.")
_testaLista.Add ("Miriam Estela Ribeiro.")
_testaLista.Add ("Jefferson-Day Andre")
_testaLista.Add ("Janice Rachel Smith.")
_testaLista.Add ("Mario Santos")
_testaLista.Add ("Jessica Lang Lima Bueno")
End Sub

End Class 

When we run the project the following happens:

The first user control in the first TabItem binds to TestaLista DataContext of the window.

After the first listbox in the user control is linked to the DataContext that will show the contents of TestaLista.

The result is shown below:


Although the dependency property defined in MeuItemsSource user control, not used in the example. To do so would have to set the user in control for the dependency property as follows:

Imports System.Collections 
Imports System.Windows
Imports System.Windows.Controls

Partial Public Class macLista
Inherits UserControl

Public Shared ReadOnly MeuItemsSourceProperty The DependencyProperty

Shared Sub New ()
macLista.MeuItemsSourceProperty DependencyProperty.Register =
("MeuItemsSource", GetType (IEnumerable), GetType (macLista))
End Sub

Public Property MeuItemsSource () As IEnumerable
Get
Return DirectCast (GetValue (macLista.MeuItemsSourceProperty), IEnumerable)
End Get
Set (ByVal value As IEnumerable)
SetValue (macLista.MeuItemsSourceProperty, value)
End Set
End Property
Sub New ()
End Sub
End Class

Then just set the file MainWindow.xaml another TabItem defined as follows:

Download your code now (notepad 132bytes)

Thus we show how to perform the binding in controls created by the user.
Get the complete project here: UserControl_Binding.zip