Skip to content

Commit

Permalink
Changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Elorucov committed Oct 17, 2024
1 parent 82e9739 commit 54b72da
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion L2/Helpers/ItemsPresenterWidthFixer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private void ListBox_SizeChanged(object sender, SizeChangedEventArgs e) {
}

private void FixSize() {
Debug.WriteLine($"FixSize for items presenter. WIdth: {listBox.Bounds.Width}px");
Debug.WriteLine($"FixSize for items presenter. Width: {listBox.Bounds.Width}px");
presenter.Width = listBox.Bounds.Width;
}

Expand Down
12 changes: 6 additions & 6 deletions L2/Views/ImView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<StackPanel x:Name="Info" Grid.Column="1" Margin="12,11,0,11">
<Grid x:Name="FirstLine" Height="22" ColumnDefinitions="* Auto">
<fb:FlexPanel x:Name="ChatNameContainer" Direction="Row" JustifyContent="FlexStart" Wrap="NoWrap">
<TextBlock x:Name="ChatName" Classes="Default" Margin="0,1,0,0" FontWeight="Medium" Text="{Binding Title}" TextTrimming="CharacterEllipsis" Foreground="{DynamicResource VKTextPrimaryBrush}"/>
<TextBlock x:Name="ChatName" ClipToBounds="True" Classes="Default" Margin="0,1,0,0" FontWeight="Medium" Text="{Binding Title}" TextTrimming="CharacterEllipsis" Foreground="{DynamicResource VKTextPrimaryBrush}"/>
<vkui:VKIcon Id="{x:Static vkui:VKIconNames.Icon16Verified}" Foreground="{DynamicResource VKAccentBrush}" IsVisible="{Binding IsVerified}" Margin="6,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<vkui:VKIcon Id="{x:Static vkui:VKIconNames.Icon16Muted}" Foreground="{DynamicResource VKIconTertiaryBrush}" Margin="6,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" IsVisible="{Binding PushSettings.DisabledForever}"/>
</fb:FlexPanel>
Expand All @@ -36,9 +36,9 @@
<!--<TextBlock x:Name="LastMessage" Classes="Subhead" FontWeight="Regular" HorizontalAlignment="Left" MinHeight="20" IsVisible="{Binding ActivityStatus, Converter={x:Static StringConverters.IsNullOrEmpty}}" Foreground="{DynamicResource VKTextSubheadBrush}" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" MaxLines="1" Inlines="{Binding LastMessage, Converter={StaticResource micc}}"/>-->
<Grid x:Name="LastMessage" ColumnDefinitions="Auto *" Height="18" IsVisible="{Binding ActivityStatus, Converter={x:Static StringConverters.IsNullOrEmpty}}">
<TextBlock x:Name="LastMessageSender" Grid.Column="0" Classes="Subhead" FontWeight="Regular" Foreground="{DynamicResource VKTextPrimaryBrush}" Text="{Binding LastMessage, Converter={StaticResource msnc}}" MaxLines="1" TextTrimming="CharacterEllipsis"/>
<TextBlock x:Name="LastMessageText" Grid.Column="1" Classes="Subhead" Margin="0,0,8,0" FontWeight="Regular" Foreground="{DynamicResource VKTextSubheadBrush}" Text="{Binding LastMessage}" MaxLines="1" TextTrimming="CharacterEllipsis"/>
<TextBlock x:Name="LastMessageText" ClipToBounds="True" Grid.Column="1" Classes="Subhead" Margin="0,0,8,0" FontWeight="Regular" Foreground="{DynamicResource VKTextSubheadBrush}" Text="{Binding LastMessage}" MaxLines="1" TextTrimming="CharacterEllipsis"/>
</Grid>
<TextBlock x:Name="ActivityStatusText" Classes="Subhead" FontWeight="Regular" HorizontalAlignment="Left" IsVisible="{Binding ActivityStatus, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" Foreground="{DynamicResource VKAccentBrush}" Text="{Binding ActivityStatus}" TextTrimming="CharacterEllipsis"/>
<TextBlock x:Name="ActivityStatusText" ClipToBounds="True" Classes="Subhead" FontWeight="Regular" HorizontalAlignment="Left" IsVisible="{Binding ActivityStatus, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" Foreground="{DynamicResource VKAccentBrush}" Text="{Binding ActivityStatus}" TextTrimming="CharacterEllipsis"/>

<Path x:Name="PinIndicator" Grid.Column="1" IsVisible="{Binding IsPinned}" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="1,1,13,1" Fill="{DynamicResource VKIconSecondaryAlphaBrush}" Data="{StaticResource Icon16Pin}"/>
<StackPanel x:Name="Indicators" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,0,12,0">
Expand Down Expand Up @@ -72,7 +72,7 @@
<StackPanel x:Name="Info" Grid.Column="1" Margin="12,6,0,0">
<Grid x:Name="FirstLine" Height="22" ColumnDefinitions="* Auto">
<fb:FlexPanel x:Name="ChatNameContainer" Direction="Row" JustifyContent="FlexStart" Wrap="NoWrap">
<TextBlock x:Name="ChatName" Classes="Default" Margin="0,1,0,0" FontWeight="Medium" Text="{Binding Title}" TextTrimming="CharacterEllipsis" Foreground="{DynamicResource VKTextPrimaryBrush}"/>
<TextBlock x:Name="ChatName" ClipToBounds="True" MaxLines="1" Classes="Default" Margin="0,1,0,0" FontWeight="Medium" Text="{Binding Title}" TextTrimming="CharacterEllipsis" Foreground="{DynamicResource VKTextPrimaryBrush}"/>
<vkui:VKIcon Id="{x:Static vkui:VKIconNames.Icon16Verified}" Foreground="{DynamicResource VKAccentBrush}" IsVisible="{Binding IsVerified}" Margin="6,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
<vkui:VKIcon Id="{x:Static vkui:VKIconNames.Icon16Muted}" Foreground="{DynamicResource VKIconTertiaryBrush}" Margin="6,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" IsVisible="{Binding PushSettings.DisabledForever}"/>
</fb:FlexPanel>
Expand All @@ -90,8 +90,8 @@
<Setter Property="Foreground" Value="{DynamicResource VKTextPrimaryBrush}"/>
</Style>
</Grid.Styles>
<TextBlock x:Name="LastMessage" Classes="Subhead" FontWeight="Regular" HorizontalAlignment="Left" MinHeight="18" Margin="0,0,12,0" IsVisible="{Binding ActivityStatus, Converter={x:Static StringConverters.IsNullOrEmpty}}" Foreground="{DynamicResource VKTextSubheadBrush}" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" MaxLines="2" Inlines="{Binding LastMessage, Converter={StaticResource micc}}"/>
<TextBlock x:Name="ActivityStatusText" Classes="Subhead" FontWeight="Regular" HorizontalAlignment="Left" MinHeight="18" IsVisible="{Binding ActivityStatus, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" Foreground="{DynamicResource VKAccentBrush}" TextWrapping="Wrap" Text="{Binding ActivityStatus}" MaxLines="2" TextTrimming="CharacterEllipsis"/>
<TextBlock x:Name="LastMessage" ClipToBounds="True" Classes="Subhead" FontWeight="Regular" HorizontalAlignment="Left" MinHeight="18" Margin="0,0,12,0" IsVisible="{Binding ActivityStatus, Converter={x:Static StringConverters.IsNullOrEmpty}}" Foreground="{DynamicResource VKTextSubheadBrush}" TextWrapping="Wrap" TextTrimming="CharacterEllipsis" MaxLines="2" Inlines="{Binding LastMessage, Converter={StaticResource micc}}"/>
<TextBlock x:Name="ActivityStatusText" ClipToBounds="True" Classes="Subhead" FontWeight="Regular" HorizontalAlignment="Left" MinHeight="18" IsVisible="{Binding ActivityStatus, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" Foreground="{DynamicResource VKAccentBrush}" TextWrapping="Wrap" Text="{Binding ActivityStatus}" MaxLines="2" TextTrimming="CharacterEllipsis"/>

<Path x:Name="PinIndicator" Grid.Column="1" IsVisible="{Binding IsPinned}" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="1,1,13,1" Fill="{DynamicResource VKIconSecondaryAlphaBrush}" Data="{StaticResource Icon16Pin}"/>
<StackPanel x:Name="Indicators" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right" Margin="0,0,12,0">
Expand Down
6 changes: 3 additions & 3 deletions L2/Views/ImView.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ public ImView() {

ChatsList.Loaded += ChatsList_Loaded;

ChatsList.ItemTemplate = this.Resources[Settings.ChatItemMoreRows ? "ChatItemTemplate3Row" : "ChatItemTemplate2Row"] as DataTemplate;
ChatsList.ItemTemplate = Resources[Settings.ChatItemMoreRows ? "ChatItemTemplate3Row" : "ChatItemTemplate2Row"] as DataTemplate;
Settings.SettingChanged += Settings_SettingChanged;
}

private void Settings_SettingChanged(string key, object value) {
switch (key) {
case Settings.CHAT_ITEM_MORE_ROWS:
DataTemplate template = this.Resources[(bool)value ? "ChatItemTemplate3Row" : "ChatItemTemplate2Row"] as DataTemplate;
DataTemplate template = Resources[(bool)value ? "ChatItemTemplate3Row" : "ChatItemTemplate2Row"] as DataTemplate;
ChatsList.ItemTemplate = template;

// Костыль для того, чтобы шаблон действительно сменился.
ChatsList.ItemsSource = null;
var prop = ChatsList.GetObservable(ListBox.DataContextProperty)
var prop = ChatsList.GetObservable(DataContextProperty)
.OfType<VKSession>()
.Select(v => v.ImViewModel.SortedChats);
ChatsList.Bind(ListBox.ItemsSourceProperty, prop);
Expand Down

0 comments on commit 54b72da

Please sign in to comment.