mirror of
https://github.com/knah/VRCMelonAssistant.git
synced 2024-05-21 12:53:18 +12:00
Added filter when you click on the "Installed" header, currently does not work with search
This commit is contained in:
parent
992480facc
commit
e098a22f14
|
@ -91,7 +91,19 @@
|
|||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
|
||||
<GridViewColumn x:Name="InstalledColumn" Header="{DynamicResource Mods:Header:Installed}">
|
||||
<GridViewColumn x:Name="InstalledColumn">
|
||||
<GridViewColumn.Header>
|
||||
<Button
|
||||
Name="InstalledButton"
|
||||
Margin="-5"
|
||||
Padding="9,-1,9,0"
|
||||
Background="#00000000"
|
||||
BorderThickness="0"
|
||||
Click="InstalledButton_Click"
|
||||
Content="{DynamicResource Mods:Header:Installed}"
|
||||
FontSize="11"
|
||||
/>
|
||||
</GridViewColumn.Header>
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock
|
||||
|
|
|
@ -40,6 +40,7 @@ namespace VRCMelonAssistant.Pages
|
|||
public CollectionView view;
|
||||
public bool PendingChanges;
|
||||
public bool HaveInstalledMods;
|
||||
public bool FilteredToInstalled = false;
|
||||
|
||||
private readonly SemaphoreSlim _modsLoadSem = new SemaphoreSlim(1, 1);
|
||||
|
||||
|
@ -541,6 +542,27 @@ namespace VRCMelonAssistant.Pages
|
|||
return false;
|
||||
}
|
||||
|
||||
private void InstalledButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (!FilteredToInstalled)
|
||||
{
|
||||
FilteredToInstalled = true;
|
||||
ModsListView.Items.Filter = new Predicate<object>(InstalledFilter);
|
||||
}
|
||||
else
|
||||
{
|
||||
ModsListView.Items.Filter = null;
|
||||
FilteredToInstalled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool InstalledFilter(object mod)
|
||||
{
|
||||
ModListItem item = mod as ModListItem;
|
||||
if (item.IsInstalled) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
private void Animate(TextBlock target, double oldHeight, double newHeight, TimeSpan duration)
|
||||
{
|
||||
target.Height = oldHeight;
|
||||
|
|
Loading…
Reference in a new issue