Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Settings : INotifyPropertyChanged
- {
- public enum WatermarkType {None, Text, Image};
- public event PropertyChangedEventHandler PropertyChanged;
- private void NotifyPropertyChanged(String propertyName)
- {
- PropertyChangedEventHandler handler = PropertyChanged;
- if (null != handler)
- {
- handler(this, new PropertyChangedEventArgs(propertyName));
- }
- }
- }
- public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- string parameterString = parameter as string;
- Type temp = value.GetType();
- object parameterValue = Enum.Parse(value.GetType(), parameterString);
- return parameterValue.Equals(value);
- }
- public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- string parameterString = parameter as string;
- /* if (parameterString == null)
- return DependencyProperty.UnsetValue;*/
- return Enum.Parse(targetType, parameterString);
- }
- <StackPanel Name="StackPanelWatermarkType" Margin="10,0,0,0" Grid.Row="2">
- <RadioButton GroupName="waterMarkType" IsChecked="{Binding Path=watermarkType, Converter={StaticResource EnumConverter}, ConverterParameter=None}"
- Name="rbtWatermarkNone" Checked="rbtWatermarkNone_Checked">None</RadioButton>
- <RadioButton GroupName="waterMarkType" IsChecked="{Binding Path=watermarkType, Converter={StaticResource EnumConverter}, ConverterParameter=Text}" Name="rbtwatermarkText" Checked="rbtwatermarkText_Checked" >Text</RadioButton>
- <RadioButton GroupName="waterMarkType" IsChecked="{Binding Path=watermarkType, Converter={StaticResource EnumConverter}, ConverterParameter=Image}" Name="rbtwatermarkImg" Checked="rbtwatermarkImg_Checked" >Photo</RadioButton>
- </StackPanel>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement