Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed the [Object][object] error that showed when a HyperlinkButton… #231

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions testsite/Controls/HyperlinkButtonViewModel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class HyperlinkButtonViewModel extends Fayde.MVVM.ViewModelBase {
Item: string;

constructor()
{
this.Item = "This is a test";
super();
}
}
export = HyperlinkButtonViewModel;
32 changes: 32 additions & 0 deletions testsite/Controls/hyperlinkbuttonbound.fap
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<Application
xmlns="http://schemas.wsick.com/fayde"
xmlns:x="http://schemas.wsick.com/fayde/x"
xmlns:controls="Controls"
ThemeName="Metro">

<Grid>
<Grid.DataContext>
<controls:HyperlinkButtonViewModel />
</Grid.DataContext>

<StackPanel>
<HyperlinkButton NavigateUri="#/Home" TargetName="ContentFrame" Content="{Binding }"
HorizontalAlignment="Left" VerticalAlignment="Top" IsEnabled="False">
<HyperlinkButton.ContentTemplate>
<DataTemplate>
<TextBlock Text="{Binding Item}" />
</DataTemplate>
</HyperlinkButton.ContentTemplate>
</HyperlinkButton>

<HyperlinkButton NavigateUri="#/Home" TargetName="ContentFrame" Content="{Binding }"
HorizontalAlignment="Left" VerticalAlignment="Top" IsEnabled="True">
<HyperlinkButton.ContentTemplate>
<DataTemplate>
<TextBlock Text="{Binding Item}" />
</DataTemplate>
</HyperlinkButton.ContentTemplate>
</HyperlinkButton>
</StackPanel>
</Grid>
</Application>
1 change: 1 addition & 0 deletions testsite/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
'Controls/contentcontrol.fap',
'Controls/grid.fap',
'Controls/hyperlinkbutton.fap',
'Controls/hyperlinkbuttonbound.fap',
'Controls/itemscontrol.fap',
'Controls/listbox.fap',
'Controls/passwordbox.fap',
Expand Down
22 changes: 9 additions & 13 deletions themes/Metro.theme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -594,20 +594,15 @@
<VisualState x:Name="Unfocused"/>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<TextBlock x:Name="UnderlineTextBlock"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}" Text="{TemplateBinding Content}"
TextDecorations="Underline" Visibility="Collapsed"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<TextBlock.Foreground>

<Border x:Name="UnderlineTextBlock" Margin="2,0,2,1" BorderThickness="0,0,0,1" Visibility="Collapsed">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm concerned that this will negatively affect the underline on regular text. Should we show/hide the underline text box based on whether the bound data is text?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The more I think about it...we should just apply TextDecorations = Underline should be applied to the content presenter on hover. Since TextDecorations is inheritable, it should cascade to the TextBlock in the template regardless of how it was created.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try it and see what happens - the offshore team has already asked about the underline that shows up. This way, it can be controlled by template. I like this better

<Border.BorderBrush>
<SolidColorBrush Color="{StaticResource HighlightDarkColor}"/>
</TextBlock.Foreground>
</TextBlock>
<TextBlock x:Name="DisabledOverlay" Foreground="{StaticResource DisabledForegroundBrush}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}" Text="{TemplateBinding Content}"
Visibility="Collapsed" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Canvas.ZIndex="1"/>
</Border.BorderBrush>
</Border>

<Border x:Name="DisabledOverlay" Background="#44AAAAAA" Visibility="Collapsed" Canvas.ZIndex="1" />

<ContentControl>
<ContentControl.Foreground>
<SolidColorBrush x:Name="ContentPresenterWrapperColor"
Expand All @@ -620,6 +615,7 @@
Margin="{TemplateBinding Padding}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</ContentControl>

<Rectangle x:Name="FocusVisualElement" IsHitTestVisible="false" Opacity="0" StrokeThickness="1">
<Rectangle.Stroke>
<SolidColorBrush Color="{StaticResource HighlightLightColor}"/>
Expand Down