I have textboxes inside RadGridView inside a RadTabControl.
1) My textboxes have a twoway binding to a viewmodel representing each row of the grid.
2) All rows are inside an observable collection of these viewmodels.
3) I have an observable collection of tabs which each have a list of those rows.
What I want to happen is that each time there is data inside one of the textboxes, the corresponding tab header gets an asterisk in it's name, until all the textboxes on that tab are cleared.
The problem is that the tabs are bound to a different viewmodel than the textboxes - there is no way for the textboxes to know their viewmodel is actually inside a collection which is inside another collection where the tab headers are.
So i tried using a BindingValidationError control on the RadTabControl top level, and throwing an exception each time the 'set' method is run on the textbox.my textbox binding looks like this:
<TextBox Width="100" Text="{Binding NewValue, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}"/>
The BindingValidationError handler in the code-behind that did this:
if (e.Action == ValidationErrorEventAction.Added)
{
(e.OriginalSource as Control).Background = new SolidColorBrush(Colors.Yellow);
}
if (e.Action == ValidationErrorEventAction.Removed)
{
(e.OriginalSource as Control).Background = new SolidColorBrush(Colors.White);
}
It doesn't seem to be working - is this the right way to achieve what I want?
1) My textboxes have a twoway binding to a viewmodel representing each row of the grid.
2) All rows are inside an observable collection of these viewmodels.
3) I have an observable collection of tabs which each have a list of those rows.
What I want to happen is that each time there is data inside one of the textboxes, the corresponding tab header gets an asterisk in it's name, until all the textboxes on that tab are cleared.
The problem is that the tabs are bound to a different viewmodel than the textboxes - there is no way for the textboxes to know their viewmodel is actually inside a collection which is inside another collection where the tab headers are.
So i tried using a BindingValidationError control on the RadTabControl top level, and throwing an exception each time the 'set' method is run on the textbox.my textbox binding looks like this:
<TextBox Width="100" Text="{Binding NewValue, Mode=TwoWay, ValidatesOnExceptions=True, NotifyOnValidationError=True}"/>
The BindingValidationError handler in the code-behind that did this:
if (e.Action == ValidationErrorEventAction.Added)
{
(e.OriginalSource as Control).Background = new SolidColorBrush(Colors.Yellow);
}
if (e.Action == ValidationErrorEventAction.Removed)
{
(e.OriginalSource as Control).Background = new SolidColorBrush(Colors.White);
}
It doesn't seem to be working - is this the right way to achieve what I want?