Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WPF]Set the name of a control #562

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions Xwt.WPF/Xwt.WPFBackend/WidgetBackend.cs
Expand Up @@ -178,6 +178,12 @@ protected virtual void SetWidgetColor (Color value)
set { Widget.Opacity = value; }
}

public string Name
{
get { return Widget.Name; }
set { Widget.Name = value; }
}

FontData GetWidgetFont ()
{
if (!(Widget is Control)) {
Expand Down
1 change: 1 addition & 0 deletions Xwt.WPF/Xwt.WPFBackend/WindowFrameBackend.cs
Expand Up @@ -59,6 +59,7 @@ void IWindowFrameBackend.Initialize (IWindowFrameEventSink eventSink)
Initialize ();
}

public object Tag { get { return window.Tag; } set { window.Tag = value; } }
public ApplicationContext Context { get; private set; }

public virtual void Initialize ()
Expand Down
5 changes: 5 additions & 0 deletions Xwt/Xwt.Backends/IWidgetBackend.cs
Expand Up @@ -63,6 +63,11 @@ public interface IWidgetBackend: IBackend
/// <value><c>true</c> if sensitive; otherwise, <c>false</c>.</value>
bool Sensitive { get; set; }

/// <summary>
/// Gets or sets the name of this widget.
/// </summary>
string Name { get; set; }

/// <summary>
/// Gets or sets a value indicating whether this widget can get focus.
/// </summary>
Expand Down
2 changes: 2 additions & 0 deletions Xwt/Xwt.Backends/IWindowFrameBackend.cs
Expand Up @@ -92,6 +92,8 @@ public interface IWindowFrameBackend: IBackend
/// </summary>
/// <value>The screen.</value>
object Screen { get; }

object Tag { get; set; }
}

public interface IWindowFrameEventSink
Expand Down
5 changes: 4 additions & 1 deletion Xwt/Xwt/Widget.cs
Expand Up @@ -590,7 +590,10 @@ public void Hide ()
/// <value>The widgets name.</value>
/// <remarks>The name can be used to identify this widget by e.g. designers.</remarks>
[DefaultValue (null)]
public string Name { get; set; }
public string Name {
get { return Backend.Name; }
set { Backend.Name = value; }
}

/// <summary>
/// Gets the parent widget of this <see cref="Xwt.Widget"/>.
Expand Down
4 changes: 3 additions & 1 deletion Xwt/Xwt/WindowFrame.cs
Expand Up @@ -72,7 +72,7 @@ public class WindowFrame: XwtComponent, IAnimatable
bool pendingReallocation;
Image icon;
WindowFrame transientFor;

public override object Tag { get { return Backend.Tag; } set { Backend.Tag = value; } }
protected class WindowBackendHost: BackendHost<WindowFrame,IWindowFrameBackend>, IWindowFrameEventSink
{
protected override void OnBackendCreated ()
Expand All @@ -83,7 +83,9 @@ protected override void OnBackendCreated ()
Parent.size = Backend.Bounds.Size;
Backend.EnableEvent (WindowFrameEvent.BoundsChanged);
}



public void OnBoundsChanged (Rectangle bounds)
{
Parent.OnBoundsChanged (new BoundsChangedEventArgs () { Bounds = bounds });
Expand Down
2 changes: 1 addition & 1 deletion Xwt/Xwt/XwtComponent.cs
Expand Up @@ -76,7 +76,7 @@ protected virtual BackendHost CreateBackendHost ()
/// <summary>
/// A value, that can be used to identify this component
/// </summary>
public object Tag { get; set; }
public virtual object Tag { get; set; }

/// <summary>
/// Maps an event handler of an Xwt component to an event identifier.
Expand Down