Skip to content

Commit ad1b9ae

Browse files
committed
fix problem with not always displaing DrawingVisuals on PlanView
1 parent e3ddec2 commit ad1b9ae

File tree

4 files changed

+34
-18
lines changed

4 files changed

+34
-18
lines changed

sources/RevitDBExplorer/RevitDBExplorer.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
<PackageReference Include="CircularBuffer" Version="1.3.0" />
6464
<PackageReference Include="LoxSmoke.DocXml" Version="3.5.0" />
6565
<PackageReference Include="NSourceGenerators.CodeToString" Version="0.3.0" />
66-
<PackageReference Include="RevitDBExplorer.Augmentations" Version="0.5.0.$(RevitYear)" />
66+
<PackageReference Include="RevitDBExplorer.Augmentations" Version="0.6.0.$(RevitYear)" />
6767
<PackageReference Include="RevitDBScripting" Version="1.0.0.$(RevitYear)" />
6868
<PackageReference Include="SimMetrics.Net" Version="1.0.5" />
6969
<PackageReference Include="System.Buffers" Version="4.5.1" />

sources/RevitDBExplorer/UIComponents/Workspaces/WorkspaceViewModel.cs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,7 @@ public bool IsActive
5858
isActive = value;
5959
OnPropertyChanged();
6060
}
61-
}
62-
public string Title
63-
{
64-
get
65-
{
66-
return title;
67-
}
68-
set
69-
{
70-
title = value;
71-
OnPropertyChanged();
72-
}
73-
}
61+
}
7462
public InfoAboutSource InfoAboutSource
7563
{
7664
get
@@ -177,10 +165,9 @@ public void PopulateExplorerTree(SourceOfObjects sourceOfObjects, bool workspace
177165
{
178166
ExplorerTree.PopulateTreeView(sourceOfObjects);
179167
}
180-
Title = "<???>";
168+
181169
if (sourceOfObjects.Info is not null)
182-
{
183-
Title = sourceOfObjects.Info.ShortTitle.Truncate(27);
170+
{
184171
InfoAboutSource = sourceOfObjects.Info;
185172
}
186173
}

sources/RevitDBExplorer/UIComponents/Workspaces/WorkspacesView.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverterHidden" WhenFalse="Hidden"/>
2828
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverterHiddenInverted" WhenFalse="Visible" WhenTrue="Hidden"/>
2929
<converters:EnumMatchToVisibilityConverter x:Key="EnumMatchToVisibilityConverter"/>
30+
<converters:StringTruncateConverter x:Key="StringTruncateConverter" MaxChars="27"/>
31+
3032

3133
<Style TargetType="{x:Type TabItem}">
3234
<Setter Property="Template">
@@ -91,7 +93,7 @@
9193
<controls:TabControlEx ItemsSource="{Binding Workspaces}" SelectedItem="{Binding SelectedWorkspace}" TabStripPlacement="Bottom" BorderThickness="0" Padding="0" Margin="0" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" >
9294
<controls:TabControlEx.ItemTemplate>
9395
<DataTemplate>
94-
<TextBlock Text="{Binding Title}" >
96+
<TextBlock Text="{Binding InfoAboutSource.ShortTitle, Converter={StaticResource StringTruncateConverter}}" >
9597
<TextBlock.ToolTip>
9698
<StackPanel Orientation="Vertical">
9799
<TextBlock Text="{Binding InfoAboutSource.ShortTitle}" />
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Windows;
4+
using System.Windows.Data;
5+
6+
namespace RevitDBExplorer.WPF.Converters
7+
{
8+
internal class StringTruncateConverter : DependencyObject, IValueConverter
9+
{
10+
public int MaxChars
11+
{
12+
get => (int)GetValue(MaxCharsProperty);
13+
set => SetValue(MaxCharsProperty, value);
14+
}
15+
public static readonly DependencyProperty MaxCharsProperty = DependencyProperty.Register("MaxChars", typeof(int), typeof(StringTruncateConverter), new PropertyMetadata(0));
16+
17+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
18+
{
19+
return (value as string).Truncate(MaxChars);
20+
}
21+
22+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
23+
{
24+
throw new NotImplementedException();
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)