Comments (7)
Only this code
can be used now
<TreeDataGrid.Resources>
<DataTemplate x:Key="FileNameCell1" DataType="m:FileTreeNodeModel">
<CheckBox IsChecked="{Binding IsChecked, Mode=TwoWay}" />
</DataTemplate>
Columns =
{
new TemplateColumn<FileTreeNodeModel>(
"Name",
"FileNameCell1",
options: new ColumnOptions<FileTreeNodeModel>
{
CanUserResizeColumn = false
}),
from avalonia.controls.treedatagrid.
from avalonia.controls.treedatagrid.
How can I make it so when I check a hierarchy node, then all subitems get also checked in a cascade way?
I imagine that you want something like this: zkSNACKs/WalletWasabi#9089 (review)
You will want a MultiSelector
And a column like this: https://github.com/SuperJMN/WalletWasabi/blob/465980eb6b900e8ef050f2582ad872f0f9157b09/WalletWasabi.Fluent/ViewModels/CoinSelection/Core/ColumnFactory.cs#L103
If you need more help, ping me and I will see if I can prepare a sample for you.
from avalonia.controls.treedatagrid.
@SuperJMN a sample would be lovely.
I tried this but it doesn't trigger a draw. This mean that I need to scroll the list to see the visual changes.
public class TreeItem : INotifyPropertyChanged
{
private bool _checked;
public TreeItem()
{
Children.CollectionChanged += DataCollectionChanged;
}
public string Display { get; set; }
public dynamic Object { get; set; }
public bool Checked
{
get
{
return _checked;
}
set
{
_checked = value;
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(nameof(Checked)));
}
}
}
public ObservableCollection<TreeItem> Children { get; set; } = new ObservableCollection<TreeItem>();
public event PropertyChangedEventHandler? PropertyChanged;
public override string ToString()
{
return Display;
}
private void DataCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
{
if (e.OldItems != null)
{
foreach (INotifyPropertyChanged item in e.OldItems)
{
item.PropertyChanged -= ItemPropertyChanged;
}
}
if (e.NewItems != null)
{
foreach (INotifyPropertyChanged item in e.NewItems)
{
item.PropertyChanged += ItemPropertyChanged;
}
}
}
public static void ItemPropertyChanged(object sender, PropertyChangedEventArgs e)
{
if (sender is TreeItem item)
{
var isChecked = item.Checked;
foreach(var child in item.Children)
{
child.Checked = isChecked;
ItemPropertyChanged(child, null);
}
}
}
}
from avalonia.controls.treedatagrid.
I feel like this is a standard feature to be expected from a Tree control with checkboxes. It should have been implemented in #127
from avalonia.controls.treedatagrid.
@SuperJMN @grokys @wieslawsoltes anyone please help, I'm stuck on this:
Screencast.from.2022-10-22.13-24-27.webm
from avalonia.controls.treedatagrid.
It only updates the drawing after the CheckboxColumn
items fall below the fold
from avalonia.controls.treedatagrid.
Related Issues (20)
- TreeDataGrid is flickering when using a binding to a task with fallback value
- Error "Object reference not set to an instance of an object." if FlatTreeDataGridSource is recreated with changing edit mode HOT 2
- Rows and columns visually lose alignment when refreshing the grid and setting the Value of the horizontal scrollbar. HOT 3
- [Question] Is TreeDataGrid more performant than TreeView HOT 1
- Implement SelectedItem for CellSelection
- Column freezing
- Cell Editing Template doesn't work with Control Themes HOT 1
- Setting MinWidth and using Auto columns breaks layout when scrolling HOT 9
- [Bug] Scrolling a control with variable row height causes visual clatter.
- [Bug] Cannot deselect row when SingleSelect is enabled
- Downloading fresh zip of Avalonia.Controls.TreeDataGrid current as of 2024-02-20, compile has build errors in the test components. HOT 2
- Row Focus Order Does Not Match Visible Order HOT 1
- TreeDataGridDemo, GitHub snapshot to ReactiveUI to CommunityToolKit.Mvvm in proper MVVM form HOT 2
- TreeDataGrid and VerticalScrollBarVisibility & VerticalScrollBarVisibility don't work HOT 3
- TreeDataGridPresenterBase Replace Regression
- [Question] How to end cell editing when clicking outside TreeDataGrid control?
- How can you sort a TreeDataGrid by column programatically?
- Missing text in column headers when changing TreeDataGrid from read-only to edit mode HOT 1
- The items are not sorted after setting column SortDirection, despite the column header shows arrow. HOT 1
- How to implement double-click on Row or Cell selection to display detailed view.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avalonia.controls.treedatagrid.