Git Product home page Git Product logo

databox's Introduction

DataBox

Build Status CI

NuGet NuGet

A DataGrid control based on ListBox control.

image

Building DataBox

First, clone the repository or download the latest zip.

git clone https://github.com/wieslawsoltes/DataBox.git

Build on Windows using script

Open up a command-prompt and execute the commands:

.\build.ps1

Build on Linux using script

Open up a terminal prompt and execute the commands:

./build.sh

Build on OSX using script

Open up a terminal prompt and execute the commands:

./build.sh

NuGet

DataBox is delivered as a NuGet package.

You can find the packages here NuGet and install the package like this:

Install-Package DataBox

Package Sources

Resources

License

DataBox is licensed under the MIT license.

databox's People

Contributors

wieslawsoltes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

databox's Issues

Strange behavior, not all ComboBoxes are set like they should when scrolling down

I tried it with a ComboBox cell and there is something strange going on. All ComboBoxes on rows that are visible on load are set but the next 13 are not. Then the rest of my 50 rows are set. Very strange! That's with ComboBox ItemsSource RelativeSource Binding.

<DataBox Margin="10"
                 Items="{CompiledBinding Projects}"
                 CanUserResizeColumns="True"
                 GridLinesVisibility="All">
...

<DataBoxTemplateColumn Header="Manager"
                                       Width="*">
                    <DataTemplate DataType="model:Project">
                        <Panel Background="Transparent">
                            <ComboBox
                                Items="{Binding Path=DataContext.Managers, 
                                        RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
                                SelectedItem="{CompiledBinding Manager}"
                                BorderThickness="0"
                                HorizontalAlignment="Stretch" />
                        </Panel>
                    </DataTemplate>
                </DataBoxTemplateColumn>

With Binding to Tag Property it's working as expected.

<DataBox x:Name="DataBox" Margin="10"
                 Items="{CompiledBinding Projects}"
                 CanUserResizeColumns="True"
                 GridLinesVisibility="All"
                 Tag="{CompiledBinding Managers}">
...

<DataBoxTemplateColumn Header="Manager"
                                       Width="*">
                    <DataTemplate DataType="model:Project">
                        <Panel Background="Transparent">
                            <ComboBox
                                Items="{CompiledBinding #DataBox.Tag}"
                                SelectedItem="{CompiledBinding Manager}"
                                BorderThickness="0"
                                HorizontalAlignment="Stretch" />
                        </Panel>
                    </DataTemplate>
                </DataBoxTemplateColumn>

You can have a look at:
https://github.com/kvalitetskontrollMarkaryd/Avalonia.DataBoxTest.git

Multi Selection Support

first of thanks for this Control it would be a prefect replacement for Avalonia DataGrid 'well it least for me!'
but can u add support for Multi Selection with ability to bind For the SelectedItems I've added Extension to support this but it would be great to have this Built-in
my code idk if it's the best way to do it! but it's work for me.

public class DataBoxExtended : DataBox.DataBox, IStyleable {
 public static readonly DirectProperty<DataBoxExtended, IList> SelectedItemsProperty =
     AvaloniaProperty.RegisterDirect(nameof(SelectedItems), o => o.SelectedItems,
         (Action<DataBoxExtended, IList>)((o, v) => o.SelectedItems = v), defaultBindingMode: BindingMode.TwoWay);

 public static readonly DirectProperty<DataBoxExtended, bool> IsSingleSelectProperty =
     AvaloniaProperty.RegisterDirect(nameof(IsSingleSelect), o => o.IsSingleSelect,
         (Action<DataBoxExtended, bool>)((o, v) => o.IsSingleSelect = v), defaultBindingMode: BindingMode.TwoWay);

 private bool _isSingleSelect;
 private IList _selectedItems;

 public DataBoxExtended() {
     _isSingleSelect = false;
     _selectedItems = null;
     RowsPresenter = new DataBoxRowsPresenter();
 }

 private protected DataBoxRowsPresenter RowsPresenter { get; set; }

 public IList SelectedItems {
     get => _selectedItems;
     set => SetAndRaise(SelectedItemsProperty, ref _selectedItems, value);
 }

 public bool IsSingleSelect {
     get => _isSingleSelect;
     private protected set => SetAndRaise(IsSingleSelectProperty, ref _isSingleSelect, value);
 }

 Type IStyleable.StyleKey => typeof(DataBox.DataBox);

 protected override void OnApplyTemplate(TemplateAppliedEventArgs e) {
     base.OnApplyTemplate(e);
     //var cm = this.FindControl<ContextMenu>("Cm");
     RowsPresenter = e.NameScope.Find<DataBoxRowsPresenter>("PART_RowsPresenter");
     RowsPresenter.SelectionMode = SelectionMode.Multiple;
     RowsPresenter.SelectionChanged += (_, _) => {
         SelectedItems = RowsPresenter.SelectedItems;
         IsSingleSelect = SelectedItems is { Count: 1 };
         SelectionChanged?.Invoke(null, EventArgs.Empty);
     };
 }

 public event EventHandler SelectionChanged;
}

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.