Intersoft ClientUI Documentation
ValueMemberPath Property (UXDomainUpDown)



Gets or sets the binding path to use for identifying the value.
Syntax
<CategoryAttribute("Common Properties")>
Public Property ValueMemberPath As String
Dim instance As UXDomainUpDown
Dim value As String
 
instance.ValueMemberPath = value
 
value = instance.ValueMemberPath
[CategoryAttribute("Common Properties")]
public string ValueMemberPath {get; set;}
[CategoryAttribute("Common Properties")]
public:
property String^ ValueMemberPath {
   String^ get();
   void set (    String^ value);
}
Remarks

UXDomainUpDown derives from ItemsControl therefore you can bind a collection of data to UXDomainUpDown. To learn more about data binding, see Data Binding Overview. To bind the data, you can either use ItemTemplate or the member path properties such as:

When ValueMemberPath and ValueMemberBinding is set, the editing mode will used this for the value. You can also customize the display mode using item template.

The following code shows you how to customize the display using item template and MVVM pattern.

C#
Copy Code
public class Book : ModelBase
{
    private string _title;
    private string _image;

    public String Title
    {
        get { return this._title; }
        set
        {
            if (this._title != value)
            {
                this._title = value;
                OnPropertyChanged("Title");
            }
        }
    }
    public String Image
    {
        get { return this._image; }
        set
        {
            if (this._image != value)
            {
                this._image = value;
                OnPropertyChanged("Image");
            }
        }
    }
}

public partial class MainPage : Page
{
    public MyTests()
    {
        InitializeComponent();
        ObservableCollection<Book> datas = new ObservableCollection<Book>();
        datas.Add(new Book() { Title = "American Cooking", Image = "/TestingMySpinner;component/Images/Books/American_cooking_1.jpg" });
        datas.Add(new Book() { Title = "Anthologies", Image = "/TestingMySpinner;component/Images/Books/Anthologies_1.jpg" });
        datas.Add(new Book() { Title = "Application and Software", Image = "/TestingMySpinner;component/Images/Books/Application_and_Software_1.jpg" });
        datas.Add(new Book() { Title = "Baking", Image = "/TestingMySpinner;component/Images/Books/Baking_1.jpg" });
        datas.Add(new Book() { Title = "Computer hardware", Image = "/TestingMySpinner;component/Images/Books/Computer_hardware_1.jpg" });
        domain.ItemsSource = datas;
    }
}
C#
Copy Code
public class RentalBookViewModel : ViewModelBase
{
    private ObservableCollection<Book> _books;

    public ObservableCollection<Book> Books
    {
        get { return this._books; }
        set
        {
            if (this._books != value)
            {
                this._books = value;
                OnPropertyChanged("Books");
            }
        }
    }

    public RentalBookViewModel()
    {
        Books = new ObservableCollection<Book>();
        Books.Add(new Book() { Title = "American Cooking", Image = "/MVVMTesting;component/Images/Books/American_cooking_1.jpg" });
        Books.Add(new Book() { Title = "Anthologies", Image = "/MVVMTesting;component/Images/Books/Anthologies_1.jpg" });
        Books.Add(new Book() { Title = "Application and Software", Image = "/MVVMTesting;component/Images/Books/Application_and_Software_1.jpg" });
        Books.Add(new Book() { Title = "Baking", Image = "/MVVMTesting;component/Images/Books/Baking_1.jpg" });
        Books.Add(new Book() { Title = "Computer hardware", Image = "/MVVMTesting;component/Images/Books/Computer_hardware_1.jpg" });
    }
}
XAML
Copy Code
<Intersoft:UXPage.Resources>
    <ViewModel:RentalBookViewModel x:Key="RentalBookViewModel" />
</Intersoft:UXPage.Resources>

<Grid x:Name="LayoutRoot" DataContext="{StaticResource RentalBookViewModel}">
    <Intersoft:UXDomainUpDown x:Name="domain" Height="100" Width="100" ItemsSource="{Binding Books}" ValueMemberPath="Title">
        <Intersoft:UXDomainUpDown.ItemTemplate>
            <DataTemplate>
                <Grid>
                    <Image Source="{Binding Image}" />
                </Grid>
            </DataTemplate>
        </Intersoft:UXDomainUpDown.ItemTemplate>
    </Intersoft:UXDomainUpDown>
</Grid>

The following code shows how to set the value using ValueMemberPath.

XAML
Copy Code
<Grid>
    <Intersoft:UXDomainUpDown x:Name="domain" Height="100" Width="170" ValueMemberPath="Title" >
        <Intersoft:UXDomainUpDown.ItemTemplate>
            <DataTemplate>
                <Grid>
                    <Image Source="{Binding Image}" />
                </Grid>
            </DataTemplate>
        </Intersoft:UXDomainUpDown.ItemTemplate>
    </Intersoft:UXDomainUpDown>
</Grid>

The following code shows how to set the value using ValueMemberBinding.

XAML
Copy Code
<Grid>
    <Intersoft:UXDomainUpDown x:Name="domain" Height="100" Width="170" ValueMemberBinding="{Binding Title}" >
        <Intersoft:UXDomainUpDown.ItemTemplate>
            <DataTemplate>
                <Grid>
                    <Image Source="{Binding Image}" />
                </Grid>
            </DataTemplate>
        </Intersoft:UXDomainUpDown.ItemTemplate>
    </Intersoft:UXDomainUpDown>
</Grid>
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

UXDomainUpDown Class
UXDomainUpDown Members

Concepts

UXDomainUpDown

Send Feedback