Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Empfohlene Antworten

Veröffentlicht

Hi,

gibts ne möglichkeit nen Defaultvalue für eine Property zu setzen?

Sprich ich habe eine Control, welches über die Property Location verfügt.

Jetzt suche ich eine Möglichkeit, dieser Property einen Defaultvalue hinzuzufügen, die der Designer beim hinzufügen hernehmen soll.

Ich habs so versucht:


        [DefaultValue(typeof(Point),"0,0")]

        public new Point Location

        {

            get { return base.Location; }

            set { base.Location = value; }

        }

Allerdings war das ein Schuss in den Ofen.

Hat jemand eine Idee?

lg

Gateway

  • Autor

Bringt rein garnichts, da der Designer erst ein new macht bevor er die Location setzten kann.

Dann setzt ich die Location im Constructor auf 0,0 und der Designer überschreibt es wieder da er erst nach der variableninitialisierung die Location setzt.

Ich hab es auch schon mit dem override vom ParentChanged versucht, bringt auch nichts.

  • Autor

Sry für doppelpost, allerdings hab ich mich jetzt mit einem alternativen Lösungsweg mehr oder weniger angefreundet da es scheinbar nicht anders realisierbar ist (so wirklich toll find ich meine Lösung aber dennoch nicht).

Ich habe LocationChanged überschrieben und frage ab ob man momentan im DesignerMode ist wenn das der Fall ist und ein zusätzlicher boolean wert auf true ist wird die Location auf 0,0 gesetzt.


        protected override void OnLocationChanged(EventArgs e)

        {

            base.OnLocationChanged(e);

            if (this.DesignMode && DesignerAutoLocationSetter)

                base.Location = new Point(0, 0);

        }

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.