Skip to content

Commit e2ca421

Browse files
committed
Tweaks to TabView Margin Resizing
1 parent d1c30a3 commit e2ca421

File tree

4 files changed

+13
-18
lines changed

4 files changed

+13
-18
lines changed

Files/UserControls/ModernSidebar.xaml.cs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,11 @@ public INavigationControlItem SelectedSidebarItem
3838
}
3939
set
4040
{
41-
if(!(value as INavigationControlItem).Equals(null))
41+
if (value != _SelectedSidebarItem)
4242
{
43-
if (value != _SelectedSidebarItem)
44-
{
45-
_SelectedSidebarItem = value;
46-
NotifyPropertyChanged("SelectedSidebarItem");
47-
}
43+
_SelectedSidebarItem = value;
44+
NotifyPropertyChanged("SelectedSidebarItem");
4845
}
49-
5046
}
5147
}
5248

Files/View Models/InteractionViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ public Thickness TabsLeftMargin
1616
set => Set(ref _TabsLeftMargin, value);
1717
}
1818

19-
private double _DragAreaWidth = 200;
20-
public double DragAreaWidth
19+
private bool _LeftMarginLoaded = true;
20+
public bool LeftMarginLoaded
2121
{
22-
get => _DragAreaWidth;
23-
set => Set(ref _DragAreaWidth, value);
22+
get => _LeftMarginLoaded;
23+
set => Set(ref _LeftMarginLoaded, value);
2424
}
2525

2626
private bool _PermanentlyDelete = false;

Files/Views/InstanceTabsView.xaml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,14 @@
2525
<StaticResource x:Key="TabViewItemHeaderBackgroundSelected" ResourceKey="RibbonBackgroundColor" />
2626
<Thickness x:Key="TabViewHeaderPadding">0,0,0,0</Thickness>
2727
</muxc:TabView.Resources>
28-
<muxc:TabView.TabStripHeaderTemplate>
29-
<DataTemplate>
28+
<muxc:TabView.TabStripHeader>
3029
<Grid
3130
x:Name="DragArea2"
3231
Background="Transparent"
33-
Width="{x:Bind local:App.InteractionViewModel.DragAreaWidth, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
32+
Width="200"
33+
Visibility="{x:Bind local:App.InteractionViewModel.LeftMarginLoaded, Mode=OneWay}"
3434
/>
35-
</DataTemplate>
36-
</muxc:TabView.TabStripHeaderTemplate>
35+
</muxc:TabView.TabStripHeader>
3736
<muxc:TabView.TabStripFooterTemplate>
3837
<DataTemplate>
3938
<Grid>

Files/Views/InstanceTabsView.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,12 +391,12 @@ public void TabStrip_SelectionChanged(object sender, SelectionChangedEventArgs e
391391
if ((tabView.SelectedItem as TabViewItem).Header.ToString() == "Settings")
392392
{
393393
App.InteractionViewModel.TabsLeftMargin = new Thickness(0, 0, 0, 0);
394-
App.InteractionViewModel.DragAreaWidth = 0;
394+
App.InteractionViewModel.LeftMarginLoaded = false;
395395
}
396396
else
397397
{
398398
App.InteractionViewModel.TabsLeftMargin = new Thickness(200, 0, 0, 0);
399-
App.InteractionViewModel.DragAreaWidth = 200;
399+
App.InteractionViewModel.LeftMarginLoaded = true;
400400
}
401401

402402
Microsoft.UI.Xaml.Controls.FontIconSource icon = new Microsoft.UI.Xaml.Controls.FontIconSource();

0 commit comments

Comments
 (0)