Code Monkey home page Code Monkey logo

Comments (10)

cm4ker avatar cm4ker commented on July 19, 2024

Hi there! The task list check is actual? What remains to implement?

from dock.

wieslawsoltes avatar wieslawsoltes commented on July 19, 2024

@cm4ker I think so not much has been done from that time.

from dock.

wieslawsoltes avatar wieslawsoltes commented on July 19, 2024

@cm4ker
Most of work must be done in Factory classes. Currently I have implemented:

Model

public interface IPinDock : IDock
{
/// <summary>
/// Gets or sets dock alignment.
/// </summary>
Alignment Alignment { get; set; }
/// <summary>
/// Gets or sets if the Dock is expanded.
/// </summary>
bool IsExpanded { get; set; }
/// <summary>
/// Gets or sets if the Dock auto hides view when pointer is not over.
/// </summary>
bool AutoHide { get; set; }

/// <summary>
/// Gets or sets top pin dock.
/// </summary>
IPinDock Top { get; set; }
/// <summary>
/// Gets or sets bottom pin dock.
/// </summary>
IPinDock Bottom { get; set; }
/// <summary>
/// Gets or sets left pin dock.
/// </summary>
IPinDock Left { get; set; }
/// <summary>
/// Gets or sets right pin dock.
/// </summary>
IPinDock Right { get; set; }

Model.INPC

/// <summary>
/// Pin dock.
/// </summary>
[DataContract(IsReference = true)]
public class PinDock : DockBase, IPinDock
{
private Alignment _alignment = Alignment.Unset;
private bool _isExpanded = false;
private bool _autoHide = true;
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public Alignment Alignment
{
get => _alignment;
set => this.RaiseAndSetIfChanged(ref _alignment, value);
}
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public bool IsExpanded
{
get => _isExpanded;
set => this.RaiseAndSetIfChanged(ref _isExpanded, value);
}
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public bool AutoHide
{
get => _autoHide;
set => this.RaiseAndSetIfChanged(ref _autoHide, value);
}
}

/// <summary>
/// Root dock.
/// </summary>
[DataContract(IsReference = true)]
public class RootDock : DockBase, IRootDock
{
private IDockWindow _window;
private IPinDock _top;
private IPinDock _bottom;
private IPinDock _left;
private IPinDock _right;
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public IDockWindow Window
{
get => _window;
set => this.RaiseAndSetIfChanged(ref _window, value);
}
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public IPinDock Top
{
get => _top;
set => this.RaiseAndSetIfChanged(ref _top, value);
}
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public IPinDock Bottom
{
get => _bottom;
set => this.RaiseAndSetIfChanged(ref _bottom, value);
}
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public IPinDock Left
{
get => _left;
set => this.RaiseAndSetIfChanged(ref _left, value);
}
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public IPinDock Right
{
get => _right;
set => this.RaiseAndSetIfChanged(ref _right, value);
}
}

Model.ReactiveUI

/// <summary>
/// Pin dock.
/// </summary>
[DataContract(IsReference = true)]
public class PinDock : DockBase, IPinDock
{
private Alignment _alignment = Alignment.Unset;
private bool _isExpanded = false;
private bool _autoHide = true;
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public Alignment Alignment
{
get => _alignment;
set => this.RaiseAndSetIfChanged(ref _alignment, value);
}
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public bool IsExpanded
{
get => _isExpanded;
set => this.RaiseAndSetIfChanged(ref _isExpanded, value);
}
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public bool AutoHide
{
get => _autoHide;
set => this.RaiseAndSetIfChanged(ref _autoHide, value);
}
}

/// <summary>
/// Root dock.
/// </summary>
[DataContract(IsReference = true)]
public class RootDock : DockBase, IRootDock
{
private IDockWindow _window;
private IPinDock _top;
private IPinDock _bottom;
private IPinDock _left;
private IPinDock _right;
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public IDockWindow Window
{
get => _window;
set => this.RaiseAndSetIfChanged(ref _window, value);
}
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public IPinDock Top
{
get => _top;
set => this.RaiseAndSetIfChanged(ref _top, value);
}
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public IPinDock Bottom
{
get => _bottom;
set => this.RaiseAndSetIfChanged(ref _bottom, value);
}
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public IPinDock Left
{
get => _left;
set => this.RaiseAndSetIfChanged(ref _left, value);
}
/// <inheritdoc/>
[DataMember(IsRequired = false, EmitDefaultValue = false)]
public IPinDock Right
{
get => _right;
set => this.RaiseAndSetIfChanged(ref _right, value);
}
}

UI

<DataTemplate DataType="Controls:IPinDock">
<DockPanel Background="Transparent">
<TabStrip Items="{Binding Views}" SelectedItem="{Binding CurrentView, Mode=TwoWay}" Background="Transparent" Focusable="false" ClipToBounds="False" DockPanel.Dock="{Binding Alignment, Converter={StaticResource AlignmentConverter}}">
<TabStrip.Styles>
<Style Selector="TabStrip:empty">
<Setter Property="IsVisible" Value="False" />
</Style>
</TabStrip.Styles>
</TabStrip>
<ContentControl Content="{Binding CurrentView}" IsVisible="{Binding IsExpanded}"/>
</DockPanel>
</DataTemplate>

<ContentControl Content="{Binding Top}" DockPanel.Dock="Top"/>
<ContentControl Content="{Binding Bottom}" DockPanel.Dock="Bottom"/>
<ContentControl Content="{Binding Left}" DockPanel.Dock="Left"/>
<ContentControl Content="{Binding Right}" DockPanel.Dock="Right"/>

<Button Classes="chromeButton" DockPanel.Dock="Right" Command="{Binding Parent.Factory.PinView}" CommandParameter="{Binding CurrentView}">
<Image Source="resm:Dock.Avalonia.Assets.PinAutoHide_Dark.png?assembly=Dock.Avalonia" Height="13" Width="13" Stretch="None" />
</Button>

Factory

/// <inheritdoc/>
public abstract IPinDock CreatePinDock();

/// <inheritdoc/>
public virtual void PinView(IView view)
{
// TODO: Implement view pinning.
}

public override IPinDock CreatePinDock() => new PinDock();

public override IPinDock CreatePinDock() => new PinDock();

from dock.

wieslawsoltes avatar wieslawsoltes commented on July 19, 2024

@cm4ker @danwalmsley

I have implemented some initial code for pinning logic:
e5f3b66
5c69274

from dock.

cm4ker avatar cm4ker commented on July 19, 2024

@wieslawsoltes this is great, thanks! I'm try to look in the evening.

from dock.

ShadowDancer avatar ShadowDancer commented on July 19, 2024

At the moment there is no way to bind "Clicked" event of TabStrip. Constrols are created from viewModels and styles, so there is no code behind to write event handler. Avalonia does not support binding events.

from dock.

wieslawsoltes avatar wieslawsoltes commented on July 19, 2024

At the moment there is no way to bind "Clicked" event of TabStrip. Constrols are created from viewModels and styles, so there is no code behind to write event handler. Avalonia does not support binding events.

You can bind events to methods using behaviors:

https://github.com/wieslawsoltes/AvaloniaBehaviors/blob/2f09f7dc9da50e2b5dc85b9a8b18aec5c8a1f6dd/samples/BehaviorsTestApplication/Controls/CallMethodActionControl.xaml#L15-L19

from dock.

ShadowDancer avatar ShadowDancer commented on July 19, 2024

@wieslawsoltes I think that it would be better to handle auto-hide using active dockable, what do you think? (I mean hide dock when pin is deactivated).

See #150

from dock.

wieslawsoltes avatar wieslawsoltes commented on July 19, 2024
2021-02-03_23-52-50.mp4

from dock.

wieslawsoltes avatar wieslawsoltes commented on July 19, 2024

Closing as logic was implemented differently in master branch.

from dock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.