iSeller Commerce
iSeller POS Retail
iSeller POS F&B
iSeller POS Express
Crosslight
WebUI
ClientUI
What's New
Download Trial
Web Solution
Mobile Solution
Enterprise Solution
Custom Development
Blog
Community
Latest Development Blogs
ForumPostTopic
Browse By Tag
Hi
I have a UXGridView and for each column a FieldLabel (please see attached picture).The changes I make on FieldLabel will be synchronized directly with the UXGridView. But the Row is not in edit mode. The events ValidateRow and UpdateRow are not fired!I want the same behavior as when I change a cell in UXGridView and leave the rowHow can I do this?
Update: I could display the FieldLabel read-only and only editable in edit mode. I have not found a property like "IsEditMode".
Here some code:
<Intersoft:UXGridView Intersoft:DockPanel.IsFillElement="True" AutoGenerateColumns="False" Style="{StaticResource UXGridViewStyle}" IsBusy="{Binding IsBusy, Mode=TwoWay}" IsRefreshed="{Binding IsRefreshed, Mode=TwoWay}" SortDescriptors="{Binding QueryDescriptor.SortDescriptors, Mode=TwoWay}" PageDescriptor="{Binding QueryDescriptor.PageDescriptor}" FilterDescriptors="{Binding QueryDescriptor.FilterDescriptors, Mode=TwoWay}" PageSize="{Binding ElementName=PageSize, Path=Text}" ItemsSource="{Binding Path=Items}" SelectedItem="{Binding SelectedItem, Mode=TwoWay}" NewItem="{Binding NewItem, Mode=TwoWay}" HasChanges="{Binding HasChanges}" AutoEditOperation="{Binding AutoEditOperation}" PrepareNewRowCommand="{Binding PrepareNewRowCommand}" ValidateRowCommand="{Binding ValidateRowCommand}" InsertRowCommand="{Binding InsertRowCommand}" DeleteRowCommand="{Binding DeleteRowCommand}" UpdateCellCommand="{Binding UpdateCellCommand}" UpdateRowCommand="{Binding UpdateRowCommand}" SaveChangesCommand="{Binding SaveChangesCommand}" RejectRowCommand="{Binding RejectRowCommand}" RejectChangesCommand="{Binding RejectChangesCommand}" RefreshCommand="{Binding RefreshCommand}" CanUserAddRows="True"> <Intersoft:UXGridView.Columns> <Intersoft:UXGridViewTextColumn Binding="{Binding ID}" Visibility="Collapsed"/> <Intersoft:UXGridViewTextColumn Binding="{Binding FQDN, Mode=TwoWay, ValidatesOnExceptions=True,NotifyOnValidationError=True,ValidatesOnNotifyDataErrors=True}"/> <Intersoft:UXGridViewTextColumn Binding="{Binding Description}"/> <Intersoft:UXGridViewCheckBoxColumn Binding="{Binding Hide}" /> <Intersoft:UXGridViewTextColumn Binding="{Binding Version}" Visibility="Collapsed"/> </Intersoft:UXGridView.Columns> </Intersoft:UXGridView>
<Intersoft:UXItemsControl ItemContainerStyle="{StaticResource FieldLabelStyle}"> <Intersoft:FieldLabel Header="ID:"> <Intersoft:UXTextBox Text="{Binding SelectedItem.ID}" Style="{StaticResource FieldLabelReadOnlyTextBoxStyle}"/> </Intersoft:FieldLabel> <Intersoft:FieldLabel Header="FQDN:"> <Intersoft:UXTextBox Text="{Binding SelectedItem.FQDN, Mode=TwoWay}" Style="{StaticResource FieldLabelTextBoxStyle}"/> </Intersoft:FieldLabel> <Intersoft:FieldLabel Header="Beschreibung:" Style="{StaticResource RequiredFieldLabelStyle}"> <Intersoft:UXTextBox Text="{Binding SelectedItem.Description}" Style="{StaticResource FieldLabelTextBoxStyle}" /> </Intersoft:FieldLabel> <Intersoft:FieldLabel Header="Ausblenden:"> <Intersoft:UXCheckBox IsChecked="{Binding SelectedItem.Hide}" Style="{StaticResource FieldLabelCheckBoxStyle}" /> </Intersoft:FieldLabel> </Intersoft:UXItemsControl>
Regards
Michael
... <Intersoft:UXGridViewTextColumn Binding="{Binding FQDN, Mode=TwoWay, ValidatesOnExceptions=True,NotifyOnValidationError=True,ValidatesOnNotifyDataErrors=True}"/> ...
... <Intersoft:FieldLabel Header="FQDN:"> <Intersoft:UXTextBox Text="{Binding SelectedItem.FQDN, Mode=TwoWay}" Style="{StaticResource FieldLabelTextBoxStyle}"/> </Intersoft:FieldLabel> ...
From the snippet code, changes that you made in “FQDN” UXTextBox will be updated on both the target (the UXTextBox itself) and the source (the SelectedItem property). In TwoWay bindings, changes to the target automatically update the source. Instead of updating through UXGridView, this action will directly update the changes on the source.
Silverlight/WPF supports simple data validation in TwoWay bindings for target-to-source updates. To receive notification that a validation error has occurred or has been resolved, you should set the NotifyOnValidationError property to true on the binding object. This tells the binding engine to raise the BindingValidationError event when a validation error is added to or removed from the Validation.Errors collection.
The following example shows how to provide custom binding validation using ValidatesOnExceptions.
View Model
using ClientUI.Samples.Models; using System.ComponentModel; using System; namespace ClientUI.Samples.ViewModels { public class MainPageViewModel : INotifyPropertyChanged { public MainPageViewModel() { } private double _value; public double Value { get { return this._value; } set { if (this._value != value) { if (value < 0) throw new Exception("Amount must be greater than zero."); this._value = value; this.OnPropertyChanged("Value"); } } } protected void OnPropertyChanged(string propertyName) { PropertyChangedEventHandler handler = PropertyChanged; if (handler != null) { handler(this, new PropertyChangedEventArgs(propertyName)); } } public event PropertyChangedEventHandler PropertyChanged; } }
View
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Intersoft="http://intersoft.clientui.com/schemas" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:vm="clr-namespace:ClientUI.Samples.ViewModels" mc:Ignorable="d" x:Class="ClientUI.Samples.MainPage" Width="800" Height="600"> <Grid x:Name="LayoutRoot" Background="White"> <Grid.DataContext> <vm:MainPageViewModel/> </Grid.DataContext> <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> <Intersoft:UXTextBox Width="50" Margin="10"> <Intersoft:UXTextBox.Text> <Binding Mode="TwoWay" Path="Value" NotifyOnValidationError="true" ValidatesOnExceptions="true"/> </Intersoft:UXTextBox.Text> </Intersoft:UXTextBox> <Intersoft:UXButton Height="50" Width="150" Content="Click To Update Source"/> </StackPanel> </Grid> </UserControl>
After the sample starts, type in letters instead of numbers to get an error caused by the type converter. Type in a negative number to get an error from the source object’s set accessor. Type in a positive number to resolve the validation error. UXTextBox target-to-source updates occurs only when the UXTextBox loses focus. The button is provided to change the focus.
Hope this helps.
or
Choose this if you're already a member of Intersoft Community Forum. You can link your OpenID account to your existing Intersoft Social ID.
Choose this if you don't have an Intersoft account yet. Your authenticated OpenID will be automatically linked to your new Intersoft account.
Enter your Wordpress Blogname