Skip to content

Commit c00a9fc

Browse files
committed
unselect the previous grouped image selection if another group is selected
1 parent 9fea3c2 commit c00a9fc

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

Gui/ViewModels/Graphics/ImageTableViewModel.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,16 @@ void AnimationTimer_Tick(object? sender, EventArgs e)
196196

197197
void SelectionChanged(object sender, SelectionModelSelectionChangedEventArgs e)
198198
{
199+
// need to unselect the current selection
199200
var sm = (SelectionModel<ImageViewModel>)sender;
201+
if (SelectionModel != null && SelectionModel != sm)
202+
{
203+
SelectionModel.SelectionChanged -= SelectionChanged;
204+
SelectionModel.Clear();
205+
SelectionModel.SelectionChanged += SelectionChanged;
206+
}
207+
208+
// set main selection to the new viewmodel selection
200209
SelectionModel = sm;
201210
SelectedImage = SelectionModel.SelectedItems.Count > 0 ? sm.SelectedItems[0] : null;
202211
}

Gui/ViewModels/Graphics/ImageViewModel.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,19 @@ namespace Gui.ViewModels.Graphics;
1717

1818
public class ImageViewModel : ReactiveUI.ReactiveObject
1919
{
20-
public string Name => Model.Name;
21-
public int ImageTableIndex => Model.ImageTableIndex;
20+
public string Name
21+
=> Model.Name;
22+
23+
public int ImageTableIndex
24+
=> Model.ImageTableIndex;
2225

2326
[Unit("px")]
24-
public int Width => UnderlyingImage.Width;
27+
public int Width
28+
=> UnderlyingImage.Width;
2529

2630
[Unit("px")]
27-
public int Height => UnderlyingImage.Height;
31+
public int Height
32+
=> UnderlyingImage.Height;
2833

2934
[Unit("px")]
3035
public short XOffset

0 commit comments

Comments
 (0)