Guest User

Untitled

a guest
May 16th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.71 KB | None | 0 0
  1. <RadioButton Height="81" Width="617" Style="{StaticResource RadioButtonStyle1}">
  2. <RadioButton.tb_text>
  3. [SOMETEXT WORD]
  4. </RadioButton.tb_text>
  5. </RadioButton>
  6.  
  7. <Style x:Key="RadioButtonStyle1" TargetType="RadioButton">
  8. <Setter Property="Background" Value="Transparent"/>
  9. <Setter Property="Foreground" Value="{ThemeResource SystemControlForegroundBaseHighBrush}"/>
  10. <Setter Property="Padding" Value="8,6,0,0"/>
  11. <Setter Property="HorizontalAlignment" Value="Left"/>
  12. <Setter Property="VerticalAlignment" Value="Center"/>
  13. <Setter Property="HorizontalContentAlignment" Value="Left"/>
  14. <Setter Property="VerticalContentAlignment" Value="Top"/>
  15. <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
  16. <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
  17. <Setter Property="MinWidth" Value="120"/>
  18. <Setter Property="UseSystemFocusVisuals" Value="True"/>
  19. <Setter Property="Template">
  20. <Setter.Value>
  21. <ControlTemplate TargetType="RadioButton">
  22. <Grid Name="gv1" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
  23.  
  24. <VisualStateManager.VisualStateGroups>
  25. <VisualStateGroup x:Name="CommonStates">
  26. <VisualState x:Name="Normal"/>
  27. <VisualState x:Name="PointerOver">
  28. <Storyboard>
  29. <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke" Storyboard.TargetName="OuterEllipse">
  30. <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightBaseHighBrush}"/>
  31. </ObjectAnimationUsingKeyFrames>
  32. <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Stroke" Storyboard.TargetName="CheckOuterEllipse">
  33. <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAccentBrush}"/>
  34. </ObjectAnimationUsingKeyFrames>
  35. <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="CheckOuterEllipse">
  36. <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightTransparentBrush}"/>
  37. </ObjectAnimationUsingKeyFrames>
  38. <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="CheckGlyph">
  39. <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource SystemControlHighlightAltBaseHighBrush}"/>
  40. </ObjectAnimationUsingKeyFrames>
  41. </Storyboard>
  42. </VisualState>
  43. <VisualState x:Name="Pressed">
  44. <Storyboard>
  45.  
  46. </Storyboard>
  47. </VisualState>
  48. <VisualState x:Name="Disabled">
  49. <Storyboard>
  50.  
  51. </Storyboard>
  52. </VisualState>
  53. </VisualStateGroup>
  54. <VisualStateGroup x:Name="CheckStates">
  55. <VisualState x:Name="Checked">
  56. <Storyboard>
  57.  
  58. <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="gv1">
  59. <DiscreteObjectKeyFrame KeyTime="0">
  60. <DiscreteObjectKeyFrame.Value>
  61. <ImageBrush Stretch="Fill" ImageSource="Assets/img/btn_blue_fill.png"/>
  62. </DiscreteObjectKeyFrame.Value>
  63. </DiscreteObjectKeyFrame>
  64. </ObjectAnimationUsingKeyFrames>
  65.  
  66. </Storyboard>
  67. </VisualState>
  68. <VisualState x:Name="Unchecked">
  69. <Storyboard>
  70.  
  71. <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="gv1">
  72. <DiscreteObjectKeyFrame KeyTime="0">
  73. <DiscreteObjectKeyFrame.Value>
  74. <ImageBrush Stretch="Fill" ImageSource="Assets/img/btn_blue_line.png"/>
  75. </DiscreteObjectKeyFrame.Value>
  76. </DiscreteObjectKeyFrame>
  77. </ObjectAnimationUsingKeyFrames>
  78.  
  79. </Storyboard>
  80. </VisualState>
  81. <VisualState x:Name="Indeterminate"/>
  82. </VisualStateGroup>
  83. </VisualStateManager.VisualStateGroups>
  84.  
  85. <TextBlock Name="tb_text" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="24" Foreground="#00BBD5" Text="text"/>
  86.  
  87. <ContentPresenter x:Name="ContentPresenter" AutomationProperties.AccessibilityView="Raw" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTransitions="{TemplateBinding ContentTransitions}" Content="{TemplateBinding Content}" Grid.Column="0" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" TextWrapping="Wrap" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  88. </Grid>
  89. </ControlTemplate>
  90. </Setter.Value>
  91. </Setter>
  92. </Style>
  93.  
  94. public class Class1
  95. {
  96.  
  97. public static readonly DependencyProperty tbtextProperty = DependencyProperty.RegisterAttached(
  98. "tbtext", typeof(String), typeof(Class1), new PropertyMetadata(string.Empty));
  99.  
  100. public static void Settbtext(UIElement element, String value)
  101. {
  102. element.SetValue(tbtextProperty, value);
  103. }
  104.  
  105. public static String Gettbtext(UIElement element)
  106. {
  107. return (String)element.GetValue(tbtextProperty);
  108. }
  109. }
  110.  
  111. <Setter Property="local:Class1.tbtext" Value="some text"></Setter>
  112.  
  113. <TextBlock x:Name="tb_text" Grid.Column="1" Text="{TemplateBinding local:Class1.tbtext}"></TextBlock>
  114.  
  115. <RadioButton Height="81" Width="617" Style="{StaticResource RadioButtonStyle1}">
  116. <local:Class1.tbtext>
  117. SOMETEXT WORD
  118. </local:Class1.tbtext>
  119. </RadioButton>
Add Comment
Please, Sign In to add comment