https://linen.dev logo
Join Discord
Powered by
# haxe-ui
  • b

    brainy-machine-50829

    11/10/2019, 10:46 AM
    Well, the rows are fixed size, but the cells can be merged in y direction.
  • b

    brainy-machine-50829

    11/10/2019, 10:47 AM
    I mean, from UI point of view I can easily calculate height of the root item. Even all of them.
  • b

    brainy-machine-50829

    11/10/2019, 10:48 AM
    Although I never load too many at once. But don't unload either. So user starts with like 50 items, but it can grows to thousands over day. Usually doesn't.
  • b

    brainy-machine-50829

    11/10/2019, 10:48 AM
    Point is scrolling had to be fast.
  • b

    brainy-machine-50829

    11/10/2019, 10:48 AM
    So I'm just wondering how difficult would be to port the app to pure Haxe with haxe-ui. 😄
  • b

    bright-gpu-74537

    11/10/2019, 10:49 AM
    well, it certainly doesnt sound like a "zero effort" thing... and haxeui certainly doesnt do what you want out the box... id be interested to see the existing code though if you have some 🙂
  • b

    brainy-machine-50829

    11/10/2019, 10:50 AM
    Oh, I can look, but it's been over 2 years I made it. 😄
  • b

    bright-gpu-74537

    11/10/2019, 10:50 AM
    sure, just to get an idea really, code is much easier to follow than ideas i find 😄
  • b

    brainy-machine-50829

    11/10/2019, 10:54 AM
    This was my starting point design. This was one problem and solution. (TLDR: Using
    ItemsControl
    with settings to act like
    ListView
    was faster than
    ListView
    itself.)
  • b

    brainy-machine-50829

    11/10/2019, 10:56 AM
    Which I ended up replacing with custom class:
    Copy code
    cs
        class MyItemsControl : ItemsControl, System.Windows.Controls.Primitives.IContainItemStorage {
            object System.Windows.Controls.Primitives.IContainItemStorage.ReadItemValue(object item, DependencyProperty dp) {
                VMOrder order = (VMOrder)item;
                return new Size(this.Width, (order.Items.SelectMany(x => x.ItemsFound).Count() + 1) * 22 + 13 + order.ExpandBottom);
                //return Helper.ReadItemValue(this, item, dp.GlobalIndex);
            }
            void System.Windows.Controls.Primitives.IContainItemStorage.StoreItemValue(object item, DependencyProperty dp, object value) {
                //Helper.StoreItemValue(this, item, dp.GlobalIndex, value);
            }
            void System.Windows.Controls.Primitives.IContainItemStorage.ClearItemValue(object item, DependencyProperty dp) {
                //Helper.ClearItemValue(this, item, dp.GlobalIndex);
            }
            void System.Windows.Controls.Primitives.IContainItemStorage.ClearValue(DependencyProperty dp) {
                //Helper.ClearItemValueStorage(this, new int[] { dp.GlobalIndex });
            }
            void System.Windows.Controls.Primitives.IContainItemStorage.Clear() {
                //Helper.ClearItemValueStorage(this);
            }
        }
  • b

    brainy-machine-50829

    11/10/2019, 10:57 AM
    Basically removed all the caching and just calculated my own height based on data.
  • b

    brainy-machine-50829

    11/10/2019, 10:58 AM
    Can I share more code here, or do you rather want some pastebin?
  • b

    bright-gpu-74537

    11/10/2019, 10:59 AM
    sure - i dont mind either way
  • b

    brainy-machine-50829

    11/10/2019, 11:00 AM
    Copy code
    xml
    <local:MyItemsControl Grid.Row="2" ItemsSource="{Binding Orders}" x:Name="listView" localHelp:ItemsControlBehavior.SmartScroll="True"
                VirtualizingPanel.ScrollUnit="Pixel"
                VirtualizingPanel.VirtualizationMode="Recycling"
                VirtualizingPanel.CacheLength="1,1"
                VirtualizingPanel.IsVirtualizing="True"
                VirtualizingStackPanel.CleanUpVirtualizedItem="VirtualizingStackPanel_CleanUpVirtualizedItem"
                ScrollViewer.CanContentScroll="True"
                HorizontalContentAlignment="Stretch"
                SnapsToDevicePixels="True"
                FocusVisualStyle="{x:Null}"
                IsEnabled="{Binding Connection.ConnectionState, Converter={StaticResource connectionStateConverter}}"
                    KeyboardNavigation.DirectionalNavigation="Continue">
        <ItemsControl.Style>
            <Style TargetType="ItemsControl">
                <Style.Triggers>
                    <Trigger Property="IsEnabled" Value="False" >
                        <Setter Property="Opacity" Value="0.4"/>
                    </Trigger>
                </Style.Triggers>
            </Style>
        </ItemsControl.Style>
        <ItemsControl.ItemsPanel>
            <ItemsPanelTemplate>
                <VirtualizingStackPanel RequestBringIntoView="VirtualizingStackPanel_RequestBringIntoView" />
            </ItemsPanelTemplate>
        </ItemsControl.ItemsPanel>
        <ItemsControl.ItemTemplate>
            <DataTemplate>
                <local:OrderUserControl x:Name="item" Focusable="True" KeyboardNavigation.IsTabStop ="True" ExpandBottom="{Binding ExpandBottom}" />
            </DataTemplate>
    
        </ItemsControl.ItemTemplate>
        <ItemsControl.Template>
            <ControlTemplate>
                <ScrollViewer HorizontalScrollBarVisibility="Auto" ScrollChanged="ScrollViewer_ScrollChanged">
                    <ItemsPresenter />
                </ScrollViewer>
            </ControlTemplate>
        </ItemsControl.Template>
    </local:MyItemsControl>
  • b

    brainy-machine-50829

    11/10/2019, 11:03 AM
    This is the actual root xaml for the view. Using my own ItemsControl that I pasted before. Most of that is pretty basic setting. Few custom events to handle disabling cleanup for active Orders (that's the root item – customer order). I don't remember much of it by now, but there was a lot of little things to make sure it all worked.
  • b

    bright-gpu-74537

    11/10/2019, 11:03 AM
    my first thought is "sure its possible"... my second thought is "i dont think its simple" 🙂
  • b

    brainy-machine-50829

    11/10/2019, 11:04 AM
    Yeah. 😦
  • b

    brainy-machine-50829

    11/10/2019, 11:04 AM
    Would be so sweet to have it work on multiple platforms.
  • b

    brainy-machine-50829

    11/10/2019, 11:04 AM
    Then again I don't really have time anyway, but would like to know if it's even viable.
  • b

    bright-gpu-74537

    11/10/2019, 11:05 AM
    well, i defo think its viable... just not a 10 min job... i also think it would probably make more sense to just extend ScrollView rather than TableView and create a totally new table view type of component
  • b

    bright-gpu-74537

    11/10/2019, 11:05 AM
    at least, thats how i would probably tackle it
  • b

    brainy-machine-50829

    11/10/2019, 11:06 AM
    Hmm, that didn't even occur to me back then.
  • b

    brainy-machine-50829

    11/10/2019, 11:06 AM
    Seems like a lot of work to deal with all the loading/unloading of items, scrolling itself and such.
  • b

    bright-gpu-74537

    11/10/2019, 11:06 AM
    in haxeui "TableView extends ScrollView"
  • b

    brainy-machine-50829

    11/10/2019, 11:06 AM
    But given how long it took me to do that, I guess you're right.
  • b

    brainy-machine-50829

    11/10/2019, 11:06 AM
    Yeah I understand. Not sure how it's in WPF. But logic is solid.
  • b

    bright-gpu-74537

    11/10/2019, 11:07 AM
    so tables are just a very specialised scrollview really, the virtualisation is handled by scrollview (kinda)
  • b

    brainy-machine-50829

    11/10/2019, 11:07 AM
    I did start with data grid view there. Eventually worked my way backwards to lower level, each step taking loads of time trying to make the component work well.
  • b

    bright-gpu-74537

    11/10/2019, 11:07 AM
    so i feel if you have "MagicTable extends Tablview" you might end up fighting with tableview "stuff"
  • b

    brainy-machine-50829

    11/10/2019, 11:07 AM
    Exactly what happened here. 😄
1...134135136...1687Latest