or
| public League(string name) |
| { |
| _name = name; |
| _divisions = new List<Division>(); |
| _selected = true; |
| } |
| string _name; |
| bool? _selected; |
| public string Name { get { return _name; } } |
| public bool? Selected { get { return _selected; } } |
| public class CheckStateConverter : IValueConverter |
| { |
| public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) |
| { |
| bool? result = (bool?)value; |
| ToggleState returnValue = ToggleState.Indeterminate; |
| if (result == true) |
| returnValue = ToggleState.On; |
| else |
| { |
| if (result == false) |
| returnValue = ToggleState.Off; |
| } |
| return returnValue; |
| } |
| //.... |
| <Application x:Class="CDM.App" |
| xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" |
| xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input" |
| > |
| <Application.Resources> |
| <Storyboard x:Key="FlashError"> |
| <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" |
| Storyboard.TargetProperty="(UIElement.Visibility)"> |
| <DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/> |
| <DiscreteObjectKeyFrame KeyTime="00:00:05" Value="{x:Static Visibility.Hidden}"/> |
| </ObjectAnimationUsingKeyFrames> |
| </Storyboard> |
| <Style x:Key="myErrorTemplate" TargetType="Control"> |
| <Setter Property="Validation.ErrorTemplate"> |
| <Setter.Value> |
| <ControlTemplate> |
| <StackPanel Orientation="Vertical"> |
| <Border BorderBrush="Red" BorderThickness="1"> |
| <AdornedElementPlaceholder Name="mycontrol"> |
| <Label Foreground="White" Background="Red" |
| Content="{Binding ElementName=mycontrol, |
| Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"> |
| <Label.Triggers> |
| <EventTrigger RoutedEvent="FrameworkElement.Loaded"> |
| <BeginStoryboard Storyboard="{StaticResource FlashError}" /> |
| </EventTrigger> |
| </Label.Triggers> |
| </Label> |
| </AdornedElementPlaceholder> |
| </Border> |
| <!--<Label Foreground="White" Background="Red" |
| Content="{Binding ElementName=mycontrol, |
| Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"> |
| </Label>--> |
| </StackPanel> |
| </ControlTemplate> |
| </Setter.Value> |
| </Setter> |
| <Style.Triggers> |
| <Trigger Property="Validation.HasError" Value="true"> |
| <Setter Property="ToolTip" |
| Value="{Binding |
| RelativeSource={x:Static RelativeSource.Self}, |
| Path=(Validation.Errors)[0].ErrorContent}" /> |
| </Trigger> |
| </Style.Triggers> |
| </Style> |
| <Style TargetType="TextBox" BasedOn="{StaticResource myErrorTemplate}" /> |
| <Style TargetType="CheckBox" BasedOn="{StaticResource myErrorTemplate}" /> |
| <Style TargetType="telerik:RadComboBox" BasedOn="{StaticResource myErrorTemplate}" /> |
| </Application.Resources> |
| </Application> |
| public Platten() |
| { |
| this.preisReference.AssociationChanged += new CollectionChangeEventHandler(preisReference_AssociationChanged); |
| this.AddError("preis", "Preiscode fehlt!"); |
| } |
| void preisReference_AssociationChanged(object sender, CollectionChangeEventArgs e) |
| { |
| if (e.Action == CollectionChangeAction.Remove) |
| { |
| OnPropertyChanging("preis"); |
| } |
| else |
| { |
| if (e.Action == CollectionChangeAction.Add) |
| { |
| this.RemoveError("preis"); |
| } |
| OnPropertyChanged("preis"); |
| } |
| } |
| #region IDataErrorInfo Members |
| private Dictionary<string, string> m_validationErrors = new Dictionary<string, string>(); |
| private void AddError(string columnName, string msg) |
| { |
| if (!m_validationErrors.ContainsKey(columnName)) |
| { |
| m_validationErrors.Add(columnName, msg); |
| } |
| } |
| private void RemoveError(string columnName) |
| { |
| if (m_validationErrors.ContainsKey(columnName)) |
| { |
| m_validationErrors.Remove(columnName); |
| } |
| } |
| public bool HasErrors |
| { |
| get { return m_validationErrors.Count > 0; } |
| } |
| public string Error |
| { |
| get |
| { |
| if (m_validationErrors.Count > 0) |
| { |
| return "Customer data is invalid"; |
| } |
| else |
| { |
| return null; |
| } |
| } |
| } |
| public string this[string columnName] |
| { |
| get |
| { |
| if (m_validationErrors.ContainsKey(columnName)) |
| { |
| return m_validationErrors[columnName]; |
| } |
| else return null; |
| } |
| } |
| #endregion |
RadTreeViewItem rti;
for (int i = 0; i < ParentCount; i++)
{
rti =
new RadTreeViewItem();
rti.Header = Parent[i].Name;
for (int j = 0; j < ChildCount; j++)
{
rti.Items.Add(Child[j].Name);
rti.Tag = Child[j].Number);
}
MyRadTreeView.Items.Add(rti); //MyRadTreeView is declared at XAML code.
}
I want to reach rti's Tag property from any of an event(Selected, SelectionChange...), but none of these events give me the Tag property's value. The Tag's value comes with null.
How can I achieve this issue?