-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix drawables with skin generating ydd as _u
- Loading branch information
Showing
10 changed files
with
786 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
grzyClothTool/Controls/ModernLabel/ModernLabelRadioButton.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<UserControl x:Class="grzyClothTool.Controls.ModernLabelRadioButton" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:grzyClothTool.Controls" | ||
x:Name="MyModernLabelRadioButton"> | ||
|
||
<RadioButton x:Name="MyRadioButton" | ||
GroupName="{Binding GroupName, ElementName=MyModernLabelRadioButton}" | ||
IsChecked="{Binding IsChecked, ElementName=MyModernLabelRadioButton, Mode=TwoWay}" | ||
Content="{Binding Label, ElementName=MyModernLabelRadioButton}" | ||
Checked="RadioButton_Change" | ||
Unchecked="RadioButton_Change" | ||
VerticalContentAlignment="Center" | ||
HorizontalContentAlignment="Left" | ||
Padding="5,0" | ||
Margin="5"> | ||
<RadioButton.Template> | ||
<ControlTemplate TargetType="RadioButton"> | ||
<Border x:Name="border" | ||
Height="40" | ||
CornerRadius="5" | ||
Background="{StaticResource ButtonBackground}" | ||
BorderBrush="{StaticResource ButtonBorder}" | ||
BorderThickness="1"> | ||
<Grid> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="Auto"/> | ||
<ColumnDefinition Width="*"/> | ||
</Grid.ColumnDefinitions> | ||
<Ellipse x:Name="Indicator" | ||
Width="12" | ||
Height="12" | ||
Fill="Transparent" | ||
Stroke="{StaticResource ButtonFocus}" | ||
StrokeThickness="2" | ||
VerticalAlignment="Center" | ||
Margin="5,0"/> | ||
<ContentPresenter Grid.Column="1" | ||
VerticalAlignment="Center" | ||
HorizontalAlignment="Left" | ||
Margin="5,0,0,0" | ||
Content="{TemplateBinding Content}"/> | ||
</Grid> | ||
</Border> | ||
<ControlTemplate.Triggers> | ||
<Trigger Property="IsChecked" Value="True"> | ||
<Setter TargetName="Indicator" Property="Fill" Value="{StaticResource ButtonFocus}"/> | ||
</Trigger> | ||
<Trigger Property="IsMouseOver" Value="True"> | ||
<Setter TargetName="border" Property="BorderBrush" Value="{StaticResource ButtonHover}"/> | ||
</Trigger> | ||
</ControlTemplate.Triggers> | ||
</ControlTemplate> | ||
</RadioButton.Template> | ||
</RadioButton> | ||
</UserControl> |
63 changes: 63 additions & 0 deletions
63
grzyClothTool/Controls/ModernLabel/ModernLabelRadioButton.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
|
||
namespace grzyClothTool.Controls | ||
{ | ||
public partial class ModernLabelRadioButton : UserControl | ||
{ | ||
public ModernLabelRadioButton() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
public static readonly DependencyProperty GroupNameProperty = | ||
DependencyProperty.Register("GroupName", typeof(string), typeof(ModernLabelRadioButton), new PropertyMetadata(string.Empty)); | ||
|
||
public static readonly DependencyProperty LabelProperty = | ||
DependencyProperty.Register("Label", typeof(string), typeof(ModernLabelRadioButton), new PropertyMetadata(string.Empty)); | ||
|
||
public static readonly DependencyProperty IsCheckedProperty = | ||
DependencyProperty.Register("IsChecked", typeof(bool?), typeof(ModernLabelRadioButton), new PropertyMetadata(false)); | ||
|
||
public static readonly RoutedEvent RadioBtnSelectEvent = EventManager.RegisterRoutedEvent( | ||
"BtnSelectEvent", | ||
RoutingStrategy.Bubble, | ||
typeof(RoutedEventHandler), | ||
typeof(ModernLabelRadioButton) | ||
); | ||
|
||
public event RoutedEventHandler MyBtnSelectEvent | ||
{ | ||
add { AddHandler(RadioBtnSelectEvent, value); } | ||
remove { RemoveHandler(RadioBtnSelectEvent, value); } | ||
} | ||
|
||
public string GroupName | ||
{ | ||
get { return (string)GetValue(GroupNameProperty); } | ||
set { SetValue(GroupNameProperty, value); } | ||
} | ||
|
||
public bool? IsChecked | ||
{ | ||
get { return (bool?)GetValue(IsCheckedProperty); } | ||
set { SetValue(IsCheckedProperty, value); } | ||
} | ||
|
||
public string Label | ||
{ | ||
get { return (string)GetValue(LabelProperty); } | ||
set { SetValue(LabelProperty, value); } | ||
} | ||
|
||
private void RadioButton_Change(object sender, RoutedEventArgs e) | ||
{ | ||
BtnSelectEventArgs args = new(RadioBtnSelectEvent); | ||
RaiseEvent(args); | ||
} | ||
|
||
private class BtnSelectEventArgs(RoutedEvent routedEvent) : RoutedEventArgs(routedEvent) | ||
{ | ||
} | ||
} | ||
} |
Oops, something went wrong.