The ObjectDataProvider exposes the enum as a binding source : ObjectDataProvider « Windows Presentation Foundation « VB.Net Tutorial

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » Windows Presentation Foundation » ObjectDataProvider 
16.102.2.The ObjectDataProvider exposes the enum as a binding source
<Window x:Class="WpfApplication1.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:System="clr-namespace:System;assembly=mscorlib"
    xmlns:WpfApplication1="clr-namespace:WpfApplication1"
    Title="WPF" Height="100" Width="180">

    <Window.Resources>
        <ObjectDataProvider x:Key="daysData" MethodName="GetValues" ObjectType="{x:Type System:Enum}" >
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="WpfApplication1:DaysOfTheWeek"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>

    </Window.Resources>
    
    <StackPanel>
        <TextBlock Margin="5" Text="Select the day of the week:"/>
        <ComboBox Margin="5" ItemsSource="{Binding Source={StaticResource daysData}}" />
    </StackPanel>
</Window>
//File:Window.xaml.vb
Imports System.Windows

Namespace WpfApplication1
  Public Enum DaysOfTheWeek
    Monday
    Tuesday
    Wednesday
    Thursday
    Friday
    Saturday
    Sunday
  End Enum

  Public Partial Class Window1
    Inherits Window
    Public Sub New()
      InitializeComponent()
    End Sub
  End Class
End Namespace
WPF The Object Data Provider Exposes The Enum As A Binding Source
16.102.ObjectDataProvider
16.102.1.Create ObjectDataProvider and bind object to it in codeCreate ObjectDataProvider and bind object to it in code
16.102.2.The ObjectDataProvider exposes the enum as a binding sourceThe ObjectDataProvider exposes the enum as a binding source
16.102.3.Set up ObjectDataProvider in codeSet up ObjectDataProvider in code
16.102.4.Bind to Object to ObjectDataProviderBind to Object to ObjectDataProvider
16.102.5.Use Path to reference Bounded object in ItemSourceUse Path to reference Bounded object in ItemSource
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.