Commit 1f3cd1c4 authored by atraczyk's avatar atraczyk Committed by Andreas Traczyk

ui/ux: tidy addcontact textbox

- implement the addcontact textbox directly into the DOM as it is used
  only once and should not be a style element

Change-Id: Id2243b3e890e317768f9f273ab8a54bd7d2e28b8
Tuleap: #790
parent 6cae7a66
......@@ -37,90 +37,6 @@
<views:AccountSelectedToVisibility x:Key="_AccountSelectedToVisibility_" />
<views:CollapseEmptyString x:Key="_CollapseEmptyString_" />
<Style x:Key="addContactTextBoxStyle"
TargetType="TextBox">
<Setter Property="MinWidth" Value="{ThemeResource TextControlThemeMinWidth}"/>
<Setter Property="MinHeight" Value="{ThemeResource TextControlThemeMinHeight}"/>
<Setter Property="Foreground" Value="Black"/>
<Setter Property="Background" Value="white"/>
<Setter Property="BorderBrush" Value="Red"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/>
<Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/>
<Setter Property="ScrollViewer.HorizontalScrollMode" Value="Auto"/>
<Setter Property="ScrollViewer.VerticalScrollMode" Value="Auto"/>
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Hidden"/>
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Hidden"/>
<Setter Property="ScrollViewer.IsDeferredScrollingEnabled" Value="False"/>
<Setter Property="Padding" Value="4,4"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="TextBox">
<Grid>
<Grid.Resources>
<Style x:Name="DeleteButtonStyle" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="ButtonLayoutGrid"
BorderThickness="5"
Background="Yellow">
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Border x:Name="BackgroundElement"
Grid.Row="1"
Background="{TemplateBinding Background}"
Margin="5"
Opacity="1"
Grid.ColumnSpan="2"
Grid.RowSpan="1"/>
<ScrollViewer x:Name="ContentElement"
Grid.Row="1"
HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
Margin="5"
Padding="{TemplateBinding Padding}"
IsTabStop="False"
AutomationProperties.AccessibilityView="Raw"
ZoomMode="Disabled"/>
<Button x:Name="DeleteButton"
Background="Transparent"
Grid.Row="1"
FontFamily="Segoe MDL2 Assets"
Foreground="LightBlue"
Content="&#xE1E2;"
Click="_ringTxtBx__Click"
BorderThickness="{TemplateBinding BorderThickness}"
Margin="{ThemeResource HelperButtonThemePadding}"
IsTabStop="False"
Grid.Column="1"
Visibility="Visible"
FontSize="20"
MinWidth="34"
VerticalAlignment="Stretch"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!-- template for contacts. -->
<DataTemplate x:Key="ContactTemplate"
x:DataType="local:Contact">
......@@ -1154,12 +1070,6 @@
</Grid>
</Grid>
</Grid>
<!-- smartList and settings. -->
<Grid Grid.Row="1">
......@@ -1172,25 +1082,60 @@
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!--Style="{StaticResource addContactTextBoxStyle}"-->
<TextBox x:Name="_ringTxtBx_"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Width="320"
TextWrapping="Wrap"
KeyDown="_ringTxtBx__KeyDown"
KeyUp="_ringTxtBx__KeyUp"
Text=""/>
<ListBox x:Name="_smartList_"
Grid.Row="2"
Margin="0"
Padding="0"
SelectionChanged="_smartList__SelectionChanged"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollMode="Enabled"
ItemContainerStyle="{StaticResource contactsListBoxStyle}"
ItemTemplate="{StaticResource SmartPanelItemsTemplate}"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Border x:Name="BackgroundElement"
Grid.Column="0"
Background="White"
Margin="6"
Opacity="1"
Grid.ColumnSpan="2">
</Border>
<TextBox x:Name="_ringTxtBx_"
Grid.Column="0"
VerticalAlignment="Center"
BorderThickness="0"
HorizontalAlignment="Stretch"
Padding="4"
Margin="6"
Foreground="Black"
Background="White"
TextWrapping="Wrap"
KeyDown="_ringTxtBx__KeyDown"
KeyUp="_ringTxtBx__KeyUp"
Text="">
</TextBox>
<Button x:Name="_addButton_"
Background="Transparent"
Grid.Column="1"
FontFamily="Segoe MDL2 Assets"
Foreground="LightBlue"
Content=" &#xE1E2;"
Click="_ringTxtBx__Click"
BorderThickness="0"
Visibility="Visible"
FontSize="20"
Width="38"
Margin="6"
Padding="4,4,8,4"
VerticalAlignment="Stretch">
<Button.RenderTransform>
<TranslateTransform X="0"/>
</Button.RenderTransform>
</Button>
</Grid>
<ListBox x:Name="_smartList_"
Grid.Row="2"
Margin="0"
Padding="0"
SelectionChanged="_smartList__SelectionChanged"
ScrollViewer.HorizontalScrollBarVisibility="Auto"
ScrollViewer.HorizontalScrollMode="Enabled"
ItemContainerStyle="{StaticResource contactsListBoxStyle}"
ItemTemplate="{StaticResource SmartPanelItemsTemplate}"/>
</Grid>
<!-- settings. -->
<Grid x:Name="_settingsMenu_"
......
......@@ -1585,20 +1585,20 @@ void RingClientUWP::Views::SmartPanel::_ringTxtBx__KeyUp(Platform::Object^ sende
if (e->Key == Windows::System::VirtualKey::Enter ) {
RingD::instance->lookUpName(_ringTxtBx_->Text);
for (auto it : SmartPanelItemsViewModel::instance->itemsList) {
it->_showMe = Windows::UI::Xaml::Visibility::Visible;
for (auto item : SmartPanelItemsViewModel::instance->itemsList) {
item->_showMe = Windows::UI::Xaml::Visibility::Visible;
}
return;
}
for (auto it : SmartPanelItemsViewModel::instance->itemsList) {
auto str1 = Utils::toString(it->_contact->name_);
for (auto item : SmartPanelItemsViewModel::instance->itemsList) {
auto str1 = Utils::toString(item->_contact->name_);
auto str2 = Utils::toString(_ringTxtBx_->Text);
if (str1.find(str2) != std::string::npos)
it->_showMe = Windows::UI::Xaml::Visibility::Visible;
item->_showMe = Windows::UI::Xaml::Visibility::Visible;
else
it->_showMe = Windows::UI::Xaml::Visibility::Collapsed;
item->_showMe = Windows::UI::Xaml::Visibility::Collapsed;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment