views:

42

answers:

1

If I have 7 checkBoxes, one for each day of the week, Can I assing in XAML the Tag property to each one of the the System.DayOfWeek enumeration value?

<StackPanel >
   <StackPanel.Resources>
      <system:DayOfWeek x:Key="Monday" >Monday</system:DayOfWeek>
   </StackPanel.Resources>
   <CheckBox Name="chkMo" Tag="{StaticResource Monday}">Mo</CheckBox>
     ...
</StackPanel>

Is there a way to assign directly the enum value to the tag without using resources?

+1  A: 

Yes, try the following:

 <CheckBox Name="chkMo" Tag="{x:Static system:DayOfWeek.Monday}">Mo</CheckBox>
wpfwannabe