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

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Development
8.Event
9.File Directory
10.Generics
11.GUI
12.Language Basics
13.LINQ
14.Network Remote
15.Security
16.Thread
17.Windows Presentation Foundation
18.Windows System
19.XML
20.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » Windows Presentation Foundation » ObjectDataProviderScreenshots 
The ObjectDataProvider exposes the enum as a binding source
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

   
    
    
    
    
  
Related examples in the same category
1.Create ObjectDataProvider and bind object to it in codeCreate ObjectDataProvider and bind object to it in code
2.Set up ObjectDataProvider in codeSet up ObjectDataProvider in code
3.Bind to Object to ObjectDataProviderBind to Object to ObjectDataProvider
4.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.