I’ve defined colors in a separate styles.ux file so I can reuse them throughout my app, which I included in my MainView.ux.
styles.ux
<Panel Width="0" Height="0">
<float4 ux:Global="Color_DTHYellow" ux:Value="#fd0" />
<float4 ux:Global="Color_White" ux:Value="#fff" />
<float4 ux:Global="Color_FacebookBlue" ux:Value="#3b5998" />
</Panel>
MainView.ux
<App>
<ux:Include File="styles.ux"/>
<Router ux:Name="router"/>
<Navigator DefaultTemplate="login">
<Pages.Login ux:Template="login" router="router"/>
<Pages.Main ux:Template="main" router="router"/>
</Navigator>
</App>
And on my login page, I’m trying to use Color_DTHYellow
for the Background
of the Page
login.ux
<Page ux:Class="Pages.Login" Background="Color_DTHYellow">
<Router ux:Dependency="router"/>
<JavaScript>
module.exports = {
login_clicked: function(){
//do login stuff
router.goto("main");
}
}
</JavaScript>
<Grid Rows="1, auto, 1">
<Button Text="Login with Facebook" Clicked="{login_clicked}" Row="1"
Color="{Color_White}" Background="{Color_FacebookBlue}" Padding="10" Margin="50"/>
</Grid>
</Page>
However, I’m getting this error: There is nothing named 'Color_DTHYellow' in this scope, and none of the global resources with alias 'Color_DTHYellow' can be used here: The type must be compatible with 'Fuse.Drawing.Brush'. 'MainView.Color_DTHYellow' is of type float4'.
So my question is why can a float4
literal be used in place of a Brush
as in
<Page ux:Class="Pages.Login" Background="#fd0">
but not a global float4
resource as in
<float4 ux:Global="Color_DTHYellow" ux:Value="#fd0" />
<Page ux:Class="Pages.Login" Background="Color_DTHYellow">
I’m just starting to learn Fuse, so any help with this would be greatly appreciated. Thanks in advance
As a side note, I basically took this pattern from the Rotating Pages example
And to clarify, this doesn’t work either:
<Button Text="Login with Facebook" Clicked="{login_clicked}" Row="1"
Color="{Color_White}" Background="{Color_FacebookBlue}" Padding="10" Margin="50"/>