I am using an external library which generates an class for UI in my game from XAML, everything generates fine and it's working as intended except for one part. It says the Root element does not exist in the namespace and thus I cannot use the designer, the creator of the library himself doesn't even know why it is doing this, it works fine for him.
<!--ek:UIRoot was not found/ does not exist in the namespace-->
<ek:UIRoot
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ek="clr-namespace:EmptyKeys.UserInterface.Designer;assembly=EmptyKeys.UserInterface.Designer"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
</Grid.RowDefinitions>
<TextBlock Text="Hello World" Grid.Row="0" />
<TextBlock Text="This is EmptyKeys In monogame" Grid.Row="1" />
</Grid>
</ek:UIRoot>
And yet it does
The project is .net4.5 and anycpu the same as what the library is built on and i've rebuild the solution many times. (those were the solutions to similar issues)
Am I missing something?
I needed to unblock the dll because it came from another computer
http://blogs.msdn.com/b/delay/p/unblockingdownloadedfile.aspx
the example is a zip but it applies the same for dlls
Related
I am absolutely new to WPF and trying to create some sample UIs in KAXAML. I need to have some emojis in the buttons therefore, I installed the emoji.wpf nuget package. By doing that, I am able to reference the emoji.wpf assembly in a Visual Studio project but if I try to refence the same assembly in a KAXAML file, it does not work.
As per this SO answer's suggestion, I have already copied the emoji.wpf.dll into the KAXAML folder (C:\Program Files (x86)\Kaxaml)
My Sample Code:
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:emoji="clr-namespace:Emoji.Wpf;assembly=Emoji.Wpf">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Button Grid.Row="0">
<StackPanel Orientation="Horizontal">
<emoji:TextBlock Text="🔴"/>
<Label>MyLabel</Label>
</StackPanel>
</Button>
</Grid>
</Page>
Error in KAXAML
'Cannot create unknown type '{clr-namespace:Emoji.Wpf;assembly=emoji.Wpf}TextBlock'.'
I am attempting to integrate a (Prism 7) WPF Window into an existing WinForms app.
My window is defined as:
<Window x:Class="ESC.SV.UI.RAndDClient.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ESC.SV.UI.RAndDClient"
xmlns:core="http://schemas.devexpress.com/winfx/2008/xaml/core"
xmlns:prism="http://www.codeplex.com/prism"
xmlns:dxb="http://schemas.devexpress.com/winfx/2008/xaml/bars"
prism:ViewModelLocator.AutoWireViewModel="True"
mc:Ignorable="d"
Title="{Binding Title}" Height="450" Width="800">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<dxb:BarContainerControl Grid.Row="0">
<dxb:ToolBarControl Caption="Main Toolbar" BarItemHorizontalIndent="10">
<dxb:BarButtonItem Content="View 1" Glyph="{dx:DXImage Image=Forward_16x16.png}" Command="{Binding ExecuteView1Command}"/>
<dxb:BarButtonItem Content="View 2" Glyph="{dx:DXImage Image=Backward_16x16.png}" Command="{Binding ExecuteView2Command}"/>
</dxb:ToolBarControl>
</dxb:BarContainerControl>
<ContentControl prism:RegionManager.RegionName="ViewsRegion" Grid.Row="1" VerticalAlignment="Top"/>
</Grid>
When I launch the WinForms app and go to show this window, I get the following error message:
... which explains to override ConfigureRegionAdapterMappings method in the bootstrapper, but when I go to create a BootStrapper class that inherits from UnityBootstrapper, it says that this is now obsolete. I know that App is supposed to inherit from PrismApplication, but does this apply to a WinForms application as well?
Any advice on how to deal with this situation is greatly appreciated.
I know that App is supposed to inherit from PrismApplication, but does this apply to a WinForms application as well?
Prism is a WPF-application framework (and UWP and Xamarin). It does not support WinForms. That being said, you can use parts of Prism individually, of course, even without any GUI (the event aggregator, for example, would work fine in a windows service).
What do you want to use from the prism library? Basically, for each feature, you have to look what the bootstrapper does to initialize and configure it and then adapt that initialization and configuration to your app.
I am trying to following along with this SO answer, however I am Visual Studio is complaining about the Datagrid is not supported in a Windows Apps project? Is there an alternative to Datagrid that I could use?
Ultimately I would like to create a grid of buttons that correspond to a MenuItem that is in a List menuLists.
I am new to databinding, so if anyone has better things I should be looking at, please let me know.
<Page
x:Class="App1.Pages.MenuItemsPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App1.Pages"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>
<CollectionViewSource x:Key="MenuItemsCollectionViewSource" Source="{Binding MenuItems}"/>
</Page.Resources>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<DataGrid Grid.Row ="0" ItemsSource ="{Binding Source = {StaticResource MenuItemsCollectionViewSource}}" />
</Grid>
</Page>
I figured it out. I'm supposed to use GridView instead when I'm working on Pages.
Same problem solved for me when I changed Targer framework to .NET Framework 4.5. Originally it was NET Framework 3. It can be changed in project properties.
There is no control. There may be third party controls, or you can get similar layouts by templating a ListView.
I'm using the System.Windows.Controls.Ribbon library for my application. Everything is working really nice, except when I maximize the window it starts to go off screen.
I also noticed that with other WPF applications but when you use a RibbonWindow it gets worse.
Here is my source code (nothing really exciting i think):
<RibbonWindow
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="WpfApplication1.MainWindow"
Title="TestWindow" Height="350" Width="525" Background="LightSteelBlue">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Ribbon Grid.Row="0">
<RibbonTab x:Name="TestRibbon" Header="TestRibbon">
<RibbonGroup>
<RibbonButton x:Name="TestButton" Label="Button" LargeImageSource="traffic_lights_green.png" />
</RibbonGroup>
</RibbonTab>
</Ribbon>
<ContentControl Grid.Row="1">
</ContentControl>
</Grid>
</RibbonWindow>
Is there some way to stop the window from doing this?
If you have not already found it, I think this may answer your problem.
systemmenu-does-not-show-correctly. It appears to be a bug specific to .net 4 implementation.
Just to let you know how I "solved" this. I'm using the Fluent Ribbon api. Which works much better for me, also you get the Office 2010 Styles.
But I highly recommend that you download the source code and compile it yourself because the last stable release was a while ago, but it's still under development and the developers respond very quickly to bugs.
http://fluent.codeplex.com/
I'm trying to see a form developed by someone else (ex-employee) in Visual Studio 2008 but keep running into the following error when I try and look at MainForm.xaml (it fails to load in the designer view):
Error Could not create an instance of type 'NumericTextBox'. D:\MySolution\GUI\MainForm.xaml
My solution is organised something like this (shortened for brevity - it's the last line of this where the error occurs):
\solution
\Gui
\App.xaml
\MainForm.xaml
\Utils
\NumericTextBox.cs
My MainForm.xaml looks something like this:
<Window x:Class="MyCompany.MyDepartment.MyProject.MainForm"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:MyCompany.MyDepartment.MyProject"
xmlns:myproject="clr-namespace:MyCompany.MyDepartment.MyProject;assembly=MyProject"
xmlns:dsp="clr-namespace:MyCompany.MyDepartment.MyProject.DSP;assembly=MyProject"
xmlns:filters="clr-namespace:MyCompany.MyDepartment.DSP.Filters;assembly=DSP"
xmlns:mydepartment="clr-namespace:MyCompany.MyDepartment.Utils;assembly=Utils"
xmlns:scope="clr-namespace:MyCompany.MyDepartment;assembly=ScopeControl"
Title="MyProject" Height="900" Width="1024"
Loaded="Window_Loaded"
Closing="Window_Closing" ResizeMode="CanResize" Icon="/MyProjectGUI;component/MyProjectGUI.ico">
<Window.Resources>
...
</Window.Resources>
<DockPanel>
<StackPanel DockPanel.Dock="Left" CanVerticallyScroll="True" CanHorizontallyScroll="False">
<GroupBox Name="SensorControlGroup" Header="Sensor Control">
...
</GroupBox>
<GroupBox Header="Sensor State">
<StackPanel Name="SensorStackPanel">
<Expander Name="EnvironmentExpander" Header="Environment">
...
</Expander>
<Expander Name="SynthExpander" Header="Synthesiser" IsExpanded="True">
<Border Margin="2" Background="White" Padding="3">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="60"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Label Grid.Column="0" Grid.Row="0">Frequency (MHz):</Label>
<mydepartment:NumericTextBox Grid.Column="1"
x:Name="SynthFrequency" DecimalPlaces="3"
Maximum="0" Minimum="0" />
What might cause that error? Everything compiles okay but the application crashes when I run it. I was hoping the two problems might be a related issue.
The two issues you mentioned are almost certainly related. In both cases, the XAML file will be processed in order to create a control. One for design purposes and the other for runtime. If there is an exception being generated at runtime while parsing the file then it follows that the designer will also be having problems with the file.
I think you need to focus on the original bug and then come back to this one. One should almost certainly fix the other.
Okay, so it turned out that although Visual Studio was set up to use v3.5 of the .net framework you need to seperately install v3.5 of the framework - it seems I only had v2 installed. Let this be a lesson for anyone else struggling with the same problems!