This shouldn't be so hard, but that's XAML for you. If I have this path:
<Path x:Key="SomeShape" Data="..." />
How can I reference it in a DrawingBrush (I am constrained to use DrawingBrushes):
<DrawingBrush>
<DrawingBrush.Drawing>
<GeometryDrawing Brush="{StaticResource SomeBrush}" Geometry="{StaticResource SomeShape_Nope}">
<!--Just put the path here dammit -->
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
Related
my Application is always with a white screen if I use style.
When I debugged I found out it doesn't leave the line
InitializeComponent();
that is in the app xaml cs
it builds, but after gets white screen forever.
this is my app xaml:
<?xml version="1.0" encoding="utf-8" ?>
<Application xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="neoFly_Montana.App">
<Application.Resources>
<!-- Application resource dictionary -->
<ResourceDictionary>
<Color x:key="BackButton">Black</Color>
<Style x:Key="button" TargetType ="but">
<Setter Property="BackgroundColor" Value="{StaticResource BackButton}"/>
</Style>
</ResourceDictionary>
</Application.Resources>
The exception:
Xamarin.Forms.Xaml.XamlParseException: Position 11:14. Type but not found in xmlns http://xamarin.com/schemas/2014/forms occurred
Help please
There is no such type but...
Replace TargetType ="but" with TargetType="Button", and everything should work fine.
And BTW, looking at your code, it's a good habit to adopt strict naming rules, in this way you don't mix out lower/upper casing or key names. I say this because the key of your color is pascal-case, while the button's is in lower-case.
You should also use more specific keys, not just button, but I believe this was just for the example.
I have added fluent.dll as reference. After that add a folder on my project called "Themes" and pasted the all theme folder on "Themes" directory. On my application.xaml i have added the below code i.e
<Application x:Class="Application"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
<Application.Resources>
<!--Attach Default Fluent Control's Theme-->
<ResourceDictionary Source="pack://application:,,,/Fluent; Component/Themes/Office2013/Generic.xaml" />
</Application.Resources>
</Application>
But when run it show a error that
an error occurred while finding the resource dictionary
I am using Vs2013 .net ver4.5.
Your spacing is wrong
<ResourceDictionary Source="pack://application:,,,/Fluent; Component/Themes/Office2013/Generic.xaml" />
should be
<ResourceDictionary Source="pack://application:,,,/Fluent;Component/Themes/Office2013/Generic.xaml" />
Whenever I add a ComponentOne gauge to my page, I receive the following exception:
WinRT information: The property 'PointerLength' was not found in type
'C1LinearGaugePointer'.
my Xaml looks like this:
<c1:C1SpeedometerGauge x:Name="myGauge"
Height="300"
Value="80"
CoverVisibility="Collapsed">
<c1:C1GaugeRange To="40" Location="0.95" Fill="#088080" Width="0.1" Opacity="0.2" />
<c1:C1GaugeRange From="0" To="80" Location="0.9" Fill="#088080" Width="0.05" Opacity="0.4" />
<c1:C1GaugeRange From="0" To="100" Location="0.88" Fill="#088080" Width="0.025" Opacity="0.6" />
<c1:C1GaugeMark Interval="20" Location="0.95"/>
<c1:C1GaugeMark Interval="10" Location="0.95"/>
<c1:C1GaugeMark Interval="5" Location="0.95"/>
<c1:C1GaugeLabel Interval="20" Alignment="In" AlignmentOffset="10" FontSize="16" />
</c1:C1SpeedometerGauge>
what can be wrong here ?
it's known issue, it has been fixed in build 315. Take the latest build here: http://prerelease.componentone.com/
I feel like I've fixed this before, but I can't remember how.
I have a tasks file that looks like this (CustomTasks.tasks):
<UsingTask AssemblyFile="CustomTasks.dll" TaskName="MyCustomTask"/>
it references an assembly (namely Ionic.Zip.dll). Ionic.Zip.dll is not in the GAC (and I don't want it to be). It sits right next to my CustomTasks.dll.
I have a directory called MSBuild one level up from my sln file which has CustomTasks.tasks, CustomTasks.dll and Ionic.Zip.dll in it.
I have a csproj that references the tasks file and calls the custom task:
<Import Project="$(ProjectDir)\..\MSBuild\CustomTasks.tasks" />
<MyCustomTask ..... />
at build time, this yields:
The "MyCustomTask" task could not be loaded from the assembly ....MyCustomTasks.dll. Could not load file or assembly 'Ionic.Zip,......' or one of its dependencies.
Got tired and frustrated and took a direct approach...I don't think this is the same way I solved the problem previously...but maybe this will help someone else. Other, more elegant solutions are more than welcome.
<Target Name="BeforeBeforeBuild" BeforeTargets="BeforeBuild">
<HandleAssemblyResolve SearchPath="$(ProjectDir)\..\MSBuild\" />
</Target>
<UsingTask TaskName="HandleAssemblyResolve" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<SearchPath ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Reflection" />
<Code Type="Fragment" Language="cs">
<![CDATA[
AppDomain.CurrentDomain.AssemblyResolve += (sender, e) =>
{
var assemblySearchPath = Path.Combine(SearchPath, e.Name.Split(',')[0]);
if (File.Exists(assemblySearchPath)) return Assembly.LoadFrom(assemblySearchPath);
return null;
};
]]>
</Code>
</Task>
</UsingTask>
This is actually easy to fix. Put your custom build tasks and dependencies in a different folder. Then dependencies are loaded correctly.
For example like so:
<UsingTask AssemblyFile="..\BuildTools\CustomTasks.dll" TaskName="MyCustomTask"/>
I created a skin using an image as background.
When my View imported the skin as skinClass, it covers up all the other controls.
How do i make all the controls display above the skin?
This is my Skin code called Background.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Skin xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<!-- host component -->
<fx:Metadata>
[HostComponent("spark.components.supportClasses.SkinnableComponent")]
</fx:Metadata>
<s:Image source="assets/Sunflower.gif" smooth="true" left="0" right="0" top="0" bottom="0">
</s:Image>
<s:states>
<s:State name="normal" />
</s:states>
</s:Skin>
This is the main view under default package
<?xml version="1.0" encoding="utf-8"?>
<s:TabbedViewNavigatorApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" applicationDPI="160"
skinClass="BackgroundImage"
>
<s:ViewNavigator label="Add" width="100%" height="100%" firstView="views.AddView"/>
<s:ViewNavigator label="List" width="100%" height="100%" firstView="views.ListView"/>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
</s:TabbedViewNavigatorApplication>
It looks like your Z index should be adjusted for the controls.
You can change your z-index like this:
parent.setChildIndex(childObject, i)
So for example if you want your controls to always be on front you need:
myControls.parent.setChildIndex(myControls, myControls.parent.numChildren -1)
Hope this helps you, even tho it's hard to answer it without any code...