Ich versuche, eine benutzerdefinierte Taste für ein kleines Symbol zu erstellen. Wissen Sie, wie Sie es bei der Einleitung der Seite zeigen können? Oder machen Sie es besser?
< /code>
Die IconButton-Klasse: < /p>
///
/// Custom Control for an icon in a small button
///
public sealed partial class IconButton : Button
{
///
/// icon code to add to the button
///
public string IconCode { get; set; } = string.Empty;
///
/// Type of the Style to apply on the Button
///
public CustomButtonType Type { get; set; }
///
///
///
public IconButton()
{
this.DefaultStyleKey = typeof(IconButton);
}
///
///
///
protected override void OnApplyTemplate()
{
try
{
base.OnApplyTemplate();
}catch
{
Console.WriteLine("error base.OnApplyTemplate");
}
try
{
switch (Type)
{
case CustomButtonType.AccentButtonStyle:
this.Style = FournierStyles.MainStyles["AccentButtonStyle"] as Style;
break;
case CustomButtonType.AddButtonStyle:
this.Style = FournierStyles.ButtonStyles["AddButtonStyle"] as Style;
break;
case CustomButtonType.PrincipalButtonStyle:
this.Style = FournierStyles.ButtonStyles["PrincipalButtonStyle"] as Style;
break;
case CustomButtonType.DangerButtonStyle:
this.Style = FournierStyles.ButtonStyles["DangerButtonStyle"] as Style;
break;
case CustomButtonType.SecondaryButtonStyle:
this.Style = FournierStyles.ButtonStyles["SecondaryButtonStyle"] as Style;
break;
case CustomButtonType.WarningButtonStyle:
this.Style = FournierStyles.ButtonStyles["WarningButtonStyle"] as Style;
break;
case CustomButtonType.InfoButtonStyle:
this.Style = FournierStyles.ButtonStyles["InfoButtonStyle"] as Style;
break;
case CustomButtonType.SucessButtonStyle:
this.Style = FournierStyles.ButtonStyles["SucessButtonStyle"] as Style;
break;
case CustomButtonType.DefaultButtonStyle:
default:
break;
}
}
catch (Exception ex)
{
throw new StyleTypeException("Impossible to set Style to button for " + ex);
}
try
{
FontIcon icon = new()
{
Glyph = IconCode,
Foreground = new SolidColorBrush(Colors.Black)
};
this.Content = icon;
this.UpdateLayout();
this.Width = 30;
this.Height = 30;
}
catch (Exception ex)
{
throw new IconButtonGenerationException("Impossible to creation icon to IconButton because " + ex);
}
}
}
Die IconButton -Klasse wird verwendet, um Eingaben für die CRUD -Modifikation zu erhalten.
Ich versuche, eine benutzerdefinierte Taste für ein kleines Symbol zu erstellen. Wissen Sie, wie Sie es bei der Einleitung der Seite zeigen können? Oder machen Sie es besser?[code] < /code> Die IconButton-Klasse: < /p> /// /// Custom Control for an icon in a small button /// public sealed partial class IconButton : Button { /// /// icon code to add to the button /// public string IconCode { get; set; } = string.Empty; /// /// Type of the Style to apply on the Button /// public CustomButtonType Type { get; set; } /// /// /// public IconButton() { this.DefaultStyleKey = typeof(IconButton); } /// /// /// protected override void OnApplyTemplate() { try { base.OnApplyTemplate(); }catch { Console.WriteLine("error base.OnApplyTemplate"); } try { switch (Type) { case CustomButtonType.AccentButtonStyle: this.Style = FournierStyles.MainStyles["AccentButtonStyle"] as Style; break; case CustomButtonType.AddButtonStyle: this.Style = FournierStyles.ButtonStyles["AddButtonStyle"] as Style; break; case CustomButtonType.PrincipalButtonStyle: this.Style = FournierStyles.ButtonStyles["PrincipalButtonStyle"] as Style; break; case CustomButtonType.DangerButtonStyle: this.Style = FournierStyles.ButtonStyles["DangerButtonStyle"] as Style; break; case CustomButtonType.SecondaryButtonStyle: this.Style = FournierStyles.ButtonStyles["SecondaryButtonStyle"] as Style; break; case CustomButtonType.WarningButtonStyle: this.Style = FournierStyles.ButtonStyles["WarningButtonStyle"] as Style; break; case CustomButtonType.InfoButtonStyle: this.Style = FournierStyles.ButtonStyles["InfoButtonStyle"] as Style; break; case CustomButtonType.SucessButtonStyle: this.Style = FournierStyles.ButtonStyles["SucessButtonStyle"] as Style; break; case CustomButtonType.DefaultButtonStyle: default: break; } } catch (Exception ex) { throw new StyleTypeException("Impossible to set Style to button for " + ex); } try { FontIcon icon = new() { Glyph = IconCode, Foreground = new SolidColorBrush(Colors.Black) }; this.Content = icon; this.UpdateLayout(); this.Width = 30; this.Height = 30; } catch (Exception ex) { throw new IconButtonGenerationException("Impossible to creation icon to IconButton because " + ex); } } } [/code] Die IconButton -Klasse wird verwendet, um Eingaben für die CRUD -Modifikation zu erhalten.
In meinem JavaScript habe ich eine autoscroll, die auf die VAR -Geschwindigkeit eingestellt ist. 1. Ich möchte die VAR -Geschwindigkeit auf 0 einstellen, wenn auf eine Schaltfläche geklickt wird....
Ich versuche, die Hintergrundfarbe einiger benutzerdefinierter Steuerelemente zu aktualisieren, die ich erstellt habe, basierend auf den Werten einer beobachtbaren Sammlung, die durch eine...
Die Seite ist auf WP. Es wurde eine Schaltfläche hinzugefügt, bei der das erste Element ein Link und das zweite der Name der Schaltfläche ist. Die Schaltfläche und der Name werden korrekt angezeigt,...