how to set up the initial page of wpf modernui application - wpf

how to set up a custom startup page in a wpf modern ui application
the startup page seems automatically linked to /pages/home.xamal
how to change to /pages/mypage.xaml
the documentation is too poor
[EDITED]
<mui:ModernWindow x:Class="SailPost.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mui="http://firstfloorsoftware.com/ModernUI"
Title="mui" IsTitleVisible="True"
LogoData="F1 M 24.9015,43.0378L 25.0963,43.4298C 26.1685,49.5853 31.5377,54.2651 38,54.2651C 44.4623,54.2651 49.8315,49.5854 50.9037,43.4299L 51.0985,43.0379C 51.0985,40.7643 52.6921,39.2955 54.9656,39.2955C 56.9428,39.2955 58.1863,41.1792 58.5833,43.0379C 57.6384,52.7654 47.9756,61.75 38,61.75C 28.0244,61.75 18.3616,52.7654 17.4167,43.0378C 17.8137,41.1792 19.0572,39.2954 21.0344,39.2954C 23.3079,39.2954 24.9015,40.7643 24.9015,43.0378 Z M 26.7727,20.5833C 29.8731,20.5833 32.3864,23.0966 32.3864,26.197C 32.3864,29.2973 29.8731,31.8106 26.7727,31.8106C 23.6724,31.8106 21.1591,29.2973 21.1591,26.197C 21.1591,23.0966 23.6724,20.5833 26.7727,20.5833 Z M 49.2273,20.5833C 52.3276,20.5833 54.8409,23.0966 54.8409,26.197C 54.8409,29.2973 52.3276,31.8106 49.2273,31.8106C 46.127,31.8106 43.6136,29.2973 43.6136,26.197C 43.6136,23.0966 46.127,20.5833 49.2273,20.5833 Z"
ContentSource="/Pages/Home.xaml">
<mui:ModernWindow.MenuLinkGroups>
<mui:LinkGroup DisplayName="SailPost Monitor">
<mui:LinkGroup.Links>
<mui:Link DisplayName="Home" Source="/Pages/Home.xaml" />
<mui:Link DisplayName="Monitor" Source="/Pages/SailPostMonitor.xaml" />
</mui:LinkGroup.Links>
</mui:LinkGroup>
<mui:LinkGroup DisplayName="Api Test Center">
<mui:LinkGroup.Links>
<mui:Link DisplayName="Test" Source="/Pages/ApiTestCenter.xaml" />
<mui:Link DisplayName="Test2" Source="/Pages/ApiTestCenter2.xaml" />
</mui:LinkGroup.Links>
</mui:LinkGroup>
<mui:LinkGroup DisplayName="settings" GroupKey="settings">
<mui:LinkGroup.Links>
<mui:Link DisplayName="software" Source="/Pages/SettingsPage.xaml" />
</mui:LinkGroup.Links>
</mui:LinkGroup>
</mui:ModernWindow.MenuLinkGroups>
<mui:ModernWindow.TitleLinks>
<mui:Link DisplayName="settings" Source="/Pages/SettingsPage.xaml" />
<mui:Link DisplayName="help" Source="https://github.com/firstfloorsoftware/mui" />
</mui:ModernWindow.TitleLinks>
</mui:ModernWindow>

Just set the ContentSource property of the ModernWindow to /Pages/SailPostMonitor.xaml:
<mui:ModernWindow x:Class="SailPost.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mui="http://firstfloorsoftware.com/ModernUI"
Title="mui" IsTitleVisible="True"
LogoData="F1 M 24.9015,43.0378L 25.0963,43.4298C 26.1685,49.5853 31.5377,54.2651 38,54.2651C 44.4623,54.2651 49.8315,49.5854 50.9037,43.4299L 51.0985,43.0379C 51.0985,40.7643 52.6921,39.2955 54.9656,39.2955C 56.9428,39.2955 58.1863,41.1792 58.5833,43.0379C 57.6384,52.7654 47.9756,61.75 38,61.75C 28.0244,61.75 18.3616,52.7654 17.4167,43.0378C 17.8137,41.1792 19.0572,39.2954 21.0344,39.2954C 23.3079,39.2954 24.9015,40.7643 24.9015,43.0378 Z M 26.7727,20.5833C 29.8731,20.5833 32.3864,23.0966 32.3864,26.197C 32.3864,29.2973 29.8731,31.8106 26.7727,31.8106C 23.6724,31.8106 21.1591,29.2973 21.1591,26.197C 21.1591,23.0966 23.6724,20.5833 26.7727,20.5833 Z M 49.2273,20.5833C 52.3276,20.5833 54.8409,23.0966 54.8409,26.197C 54.8409,29.2973 52.3276,31.8106 49.2273,31.8106C 46.127,31.8106 43.6136,29.2973 43.6136,26.197C 43.6136,23.0966 46.127,20.5833 49.2273,20.5833 Z"
ContentSource="/Pages/SailPostMonitor.xaml">

Related

How to mention source for BubbleSeries2D.Points

For a WPF project with Dev Express, is there a way i can define a series in the .xaml.cs file and reference this in the xaml file instead of manually writing the points as shown -
<Window x:Class="Bubble2DChart.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:dxc="http://schemas.devexpress.com/winfx/2008/xaml/charts" Title="Window1" Height="350" Width="620">
<Grid>
<dxc:ChartControl>
<dxc:ChartControl.CrosshairOptions>
<dxc:CrosshairOptions ShowValueLine="True" ShowValueLabels="True"/>
</dxc:ChartControl.CrosshairOptions>
<dxc:ChartControl.Diagram>
<dxc:XYDiagram2D>
<dxc:XYDiagram2D.Series>
<dxc:BubbleSeries2D Transparency="0.2" AutoSize="False" MinSize="1" MaxSize="3" ColorEach="True"
CrosshairLabelPattern="Argument: {A}; Value: {V}; Weight: {W}">
<dxc:BubbleSeries2D.Points>
<dxc:SeriesPoint Argument="A" Value="100" dxc:BubbleSeries2D.Weight="0.9" />
<dxc:SeriesPoint Argument="B" Value="60" dxc:BubbleSeries2D.Weight="0.8" />
<dxc:SeriesPoint Argument="C" Value="30" dxc:BubbleSeries2D.Weight="0.5" />
<dxc:SeriesPoint Argument="D" Value="43" dxc:BubbleSeries2D.Weight="0.4" />
<dxc:SeriesPoint Argument="E" Value="11" dxc:BubbleSeries2D.Weight="0.4"/>
<dxc:SeriesPoint Argument="F" Value="29" dxc:BubbleSeries2D.Weight="0.2"/>
<dxc:SeriesPoint Argument="G" Value="12" dxc:BubbleSeries2D.Weight="0.2"/>
<dxc:SeriesPoint Argument="H" Value="21" dxc:BubbleSeries2D.Weight="0.2"/>
<dxc:SeriesPoint Argument="I" Value="28" dxc:BubbleSeries2D.Weight="0.2"/>
</dxc:BubbleSeries2D.Points>
</dxc:BubbleSeries2D>
</dxc:XYDiagram2D.Series>
<dxc:XYDiagram2D.AxisY>
<dxc:AxisY2D GridLinesMinorVisible="True" >
<dxc:AxisY2D.WholeRange>
<dxc:Range MinValue="0" MaxValue="130"
SideMarginsValue="0" />
</dxc:AxisY2D.WholeRange>
</dxc:AxisY2D>
</dxc:XYDiagram2D.AxisY>
</dxc:XYDiagram2D>
</dxc:ChartControl.Diagram>
</dxc:ChartControl>
</Grid>
I suggest you to go through documentation: Bind a Series to a Data Source
To do this, assign your data source to the Series.DataSource property, and define the Series.ArgumentDataMember and Series.ValueDataMember properties.
You can bind a Chart to an Observable Collection, Data from an MDB File, Static Resource etc. You can follow the example to implement your functionality.

Material UI Grid component Fill second column to end of container

I am using material UI's Grid component and making use of the auto property for the first column
so I have
<Grid container className={classes.borderclass}>
<Grid item xs={"auto"}>
<Items />
</Grid>
<Grid item xs={10}>
<Content />
</Grid>
</Grid>
However this will not fill the entire container but I do not seem to see an option for remainder in the sizes.
I have looked into css calc option however I do not see a way to get the size of the auto column in react to compare against the div
any suggestions even if it is not material ui will be appreciated.
If you check the Material-UI demo, they have a working example that shows the auto property in action. So, as the example depicted here, you don't need to specify the auto keyword. Do just this:
<Grid container className={classes.borderclass}>
<Grid item xs>
<Items />
</Grid>
<Grid item xs={10}>
<Content />
</Grid>
</Grid>

AvalonDock Not rendering layout when using default layout serialization and deserialization

i am just getting started with AvalonDock and i have been beating my head on the wall for a few days now. I am trying to do the mundane task of loading my layout from the de-serialized dockingmanager. I have attempted what ("AvalonDock DockingManager does not load layout") this post has suggested and am still getting a empty screen.
my wpf application xaml is below:
<Window x:Name="frm_Main" x:Class="DataCAD.Forms.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:aD="http://schemas.xceed.com/wpf/xaml/avalondock"
Title="MainWindow" Height="563.9" Width="832" WindowState="Maximized">
<Grid Margin="0,0,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="0*"/>
</Grid.ColumnDefinitions>
<Menu HorizontalAlignment="Left" Height="24" VerticalAlignment="Top" Width="{Binding ElementName=frm_Main,Path=ActualWidth}">
<MenuItem Name="MnuI_File" Height="21" Width="35" HeaderStringFormat="" Header="File" >
<MenuItem Name="mnuFile_Importcui" Padding="15,3,3,3" Header="Import Cuix" Click="MnuFile_Importcui_OnClick">
<MenuItem.Icon>
<Image Width="24" Height="24" Source="/Images/cuiImport.png"/>
</MenuItem.Icon>
</MenuItem>
<MenuItem Name="mnuFile_Exportcui" Padding="15,3,3,3" Header="Export Cuix" Click="MnuFile_Exportcui_OnClick">
<MenuItem.Icon>
<Image Width="24" Height="24" Source="/Images/cuiExport.png"/>
</MenuItem.Icon>
</MenuItem>
<Separator />
<MenuItem Name="mnuFile_Exit" Padding="15,3,3,3" Header="Exit" Click="MnuFile_Exit_OnClick"/>
</MenuItem>
<MenuItem Name="MnuI_Edit" Height="21" Width="35" HeaderStringFormat="" Header="Edit" ></MenuItem>
<MenuItem Name="MnuI_View" Height="21" Width="42" HeaderStringFormat="" Header="View" >
<MenuItem Name="mnuView_Cuixexplorer" IsChecked="True" IsCheckable="True" Padding="15,3,3,3" Header="Cuix Explorer" Click="MnuView_Cuixexplorer_OnClick"/>
</MenuItem>
</Menu>
<aD:DockingManager x:Name="Dockman" Margin="0,21,1,0">
<aD:DockingManager.Theme>
<aD:AeroTheme/>
</aD:DockingManager.Theme>
<aD:LayoutRoot>
<aD:LayoutPanel Orientation="Vertical">
<aD:LayoutPanel Orientation="Horizontal">
<aD:LayoutAnchorablePaneGroup DockWidth="150" Orientation="Vertical">
<aD:LayoutAnchorablePane x:Name="CuixExplorerAnchor" DockWidth="150">
<aD:LayoutAnchorable x:Name="CuixExplorer" ContentId="CuixExplorer" Title="Cuix Explorer">
<TreeView Name="trv_CuixDisplay" AllowDrop="True" Drop="trv_CuiDisplay_onDrop">
</TreeView>
</aD:LayoutAnchorable>
</aD:LayoutAnchorablePane>
<aD:LayoutAnchorablePane x:Name="Gen_PropertiesAnchor" DockWidth="150">
<aD:LayoutAnchorable x:Name="Gen_Properties" ContentId="Properties" Title="Properties">
<Grid x:Name="grid"></Grid>
</aD:LayoutAnchorable>
</aD:LayoutAnchorablePane>
</aD:LayoutAnchorablePaneGroup>
<aD:LayoutDocumentPaneGroup Orientation="Vertical" DockWidth="*" x:Name="DocPane">
<aD:LayoutDocumentPane x:Name="DockingMainWindow">
<aD:LayoutDocument ContentId="default" Title="default">
<RichTextBox x:Name="DefaultTextBox"></RichTextBox>
</aD:LayoutDocument>
</aD:LayoutDocumentPane>
</aD:LayoutDocumentPaneGroup>
</aD:LayoutPanel>
<aD:LayoutAnchorablePaneGroup Orientation="Vertical" DockHeight="150" >
<aD:LayoutAnchorablePane DockHeight="150" >
<aD:LayoutAnchorable ContentId="output" Title="Output">
<TextBox x:Name="OutpuTextBox"></TextBox>
</aD:LayoutAnchorable>
</aD:LayoutAnchorablePane>
</aD:LayoutAnchorablePaneGroup>
</aD:LayoutPanel>
</aD:LayoutRoot>
</aD:DockingManager>
</Grid>
My setting xml is below:
<?xml version="1.0" encoding="utf-8"?>
<LayoutRoot xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RootPanel Orientation="Vertical">
<LayoutPanel Orientation="Horizontal">
<LayoutAnchorablePaneGroup Orientation="Vertical" DockWidth="150">
<LayoutAnchorablePane DockWidth="150">
<LayoutAnchorable AutoHideMinWidth="100" AutoHideMinHeight="100" Title="Cuix Explorer" IsSelected="True" ContentId="CuixExplorer" />
</LayoutAnchorablePane>
<LayoutAnchorablePane DockWidth="150">
<LayoutAnchorable AutoHideMinWidth="100" AutoHideMinHeight="100" Title="Properties" IsSelected="True" ContentId="Properties" />
</LayoutAnchorablePane>
</LayoutAnchorablePaneGroup>
<LayoutDocumentPaneGroup Orientation="Vertical">
<LayoutDocumentPane>
<LayoutDocument Title="default" IsSelected="True" IsLastFocusedDocument="True" ContentId="default" LastActivationTimeStamp="10/05/2013 00:30:01" />
</LayoutDocumentPane>
</LayoutDocumentPaneGroup>
</LayoutPanel>
<LayoutAnchorablePaneGroup Orientation="Vertical" DockHeight="150">
<LayoutAnchorablePane DockHeight="150">
<LayoutAnchorable AutoHideMinWidth="100" AutoHideMinHeight="100" Title="Output" IsSelected="True" ContentId="output" />
</LayoutAnchorablePane>
</LayoutAnchorablePaneGroup>
</RootPanel>
<TopSide />
<RightSide />
<LeftSide />
<BottomSide />
<FloatingWindows />
<Hidden />
</LayoutRoot>
my code is below:
public MainWindow()
{
InitializeComponent();
LoadLayout();
Left = Settings.Default.MAINWINDOW_LEFT;
Top = Settings.Default.MAINWINDOW_TOP;
Width = Settings.Default.MAINWINDOW_WIDTH;
Height = Settings.Default.MAINWINDOW_HEIGHT;
WindowState = (Settings.Default.MAINWINDOW_ISMAXIMIZED) ? WindowState.Maximized : WindowState.Normal;
}
private void MainWindow_OnClosing(object sender , CancelEventArgs cancelEventArgs)
{
Settings.Default.MAINWINDOW_LEFT = Left;
Settings.Default.MAINWINDOW_TOP = Top;
Settings.Default.MAINWINDOW_WIDTH = Width;
Settings.Default.MAINWINDOW_HEIGHT = Height;
Settings.Default.MAINWINDOW_ISMAXIMIZED = (WindowState == WindowState.Maximized);
Settings.Default.CUIXEXPLORER_ISVISIBLE = CuixExplorer.IsVisible;
Settings.Default.CUIXEXPLORER_DOCKLOCATION = CuixExplorer.PreviousContainerIndex;
Settings.Default.CUIXEXPLORER_WIDTH = CuixExplorer.FloatingWidth;
Settings.Default.CUIXEXPLORER_HEIGHT = CuixExplorer.FloatingHeight;
Settings.Default.Save();
SaveLayout();
}
private void SaveLayout()
{
var serializer = new XmlLayoutSerializer(Dockman);
using (var stream = new StreamWriter(_settingsFile))
{
serializer.Serialize(stream);
}
}
private void LoadLayout()
{
var serializer = new XmlLayoutSerializer(Dockman);
using (var stream = new StreamReader(_settingsFile))
{
serializer.Deserialize(stream);
}
}
any help is greatly appreciated. Thanks in advance.
The reason i was not able to Deserialize my layout was because i was missing the Serializer.LayoutSerializationCallback event in my LoadLayout method.
new LoadLayout method:
public void LoadLayout()
{
var serializer = new XmlLayoutSerializer(DockingManagerMain);
// Imparitive for Deserialization
serializer.LayoutSerializationCallback += (s, args) =>
{
args.Content = args.Content;
};
serializer.Deserialize(DockingLayoutConfig);
}
I have come across this issue and the problem is not the callback. It is unnecessary. The method to Deserialize will NOT work before Window_Loaded event happen. If you call it before like in this case in the window constructor the object is not fully loaded therefore cannot load properly the xml. Doing so will cause the white screen issue.
I came upon this error while switching from Syncfusion Docking Manager to Exceed Avalon Dock. I was changing the code for the loading and saving only and not where they are called from. Syncfusion dock manager loading DOES work when called f the constructor and this one obviously is not working there. No big deal, Window_Loaded do the job.
Solution from Franck works with the UserControl_Loaded event in codebehind.
a nicer thing is inherit your viewmodel from Screen and override the OnViewLoaded(object view) method. in your xaml from your view give your dockmanager a x:Name so that you can use it in the OnViewLoaded method.
Something like this (combination of Franck with Trae Moore's code):
protected override void OnViewLoaded(object view)
{
base.OnViewLoaded(view);
MyView v = view as MyView;
if (v?.myDockManager != null) {
var ser = new XmlLayoutSerializer(v.myDockManager);
// ...
}
}

Silverlight: Add a resource dictionary from another project

I have a XAML resource dictionary in project A. How can I merge it into a resource dictionary in project B?
Where Granite.Xaml is the library and ConvertersList.xaml has been marked as a resource.
<ResourceDictionary Source="/Granite.Xaml;component/ConvertersList.xaml" />
Here is the contents of the resource dictionary. Note that I had to include the assembly name in the namespace declaration even though the converters are in the same project as the dictionary. If you fail to do this you will get a runtime exception.
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:Granite.Xaml.Converters;assembly=Granite.Xaml"
>
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
<converters:DebugBreakConverter x:Key="DebugBreakConverter" />
<converters:DebugTraceConverter x:Key="DebugTraceConverter" />
<converters:DictionaryConverter x:Key="DictionaryConverter" />
<converters:MaxLengthToBoolTrueConverter x:Key="MaxLengthToBoolTrueConverter" />
<converters:MinLengthToBoolTrueConverter x:Key="MinLengthToBoolTrueConverter" />
<converters:NotBoolToVisibilityConverter x:Key="NotBoolToVisibilityConverter" />
<converters:NotConverter x:Key="NotConverter" />
<converters:NotNullToBooleanConverter x:Key="NotNullToBooleanConverter" />
<converters:NotNullToVisibilityConverter x:Key="NotNullToVisibilityConverter" />
<converters:NotZeroToBooleanConverter x:Key="NotZeroToBooleanConverter" />
<converters:NotZeroToVisibilityConverter x:Key="NotZeroToVisibilityConverter" />
<converters:NullToBooleanConverter x:Key="NullToBooleanConverter" />
<converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
<converters:StringToBooleanConverter x:Key="StringToBooleanConverter" />
<converters:StringToLowerConverter x:Key="StringToLowerConverter" />
<converters:StringToUpperConverter x:Key="StringToUpperConverter" />
<converters:ZeroToBooleanConverter x:Key="ZeroToBooleanConverter" />
<converters:ZeroToVisibilityConverter x:Key="ZeroToVisibilityConverter" />
</ResourceDictionary>
This works for me:
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Namespace.From.Your.Dll;component/Style.xaml"/>
</ResourceDictionary.MergedDictionaries>

Why is Canvas covering peer controls in Dockpanel?

Why is the Canvas covering the other Children of the Dock Panel?
I'm setting up a menu bar at the top of the client area and a status bar at the bottom of the client area of the window as per standard convention in xaml as follows:
<Window x:Class="RichCoreW.ScenEditWnd"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="ScenEditWnd" Height="490" Width="776" HorizontalAlignment="Right">
<DockPanel Name="mapDockP">
<Menu IsMainMenu="True" DockPanel.Dock="Top">
<MenuItem Header="File">
<MenuItem Header="Save" Name="menuISave" Click="menuISave_Click"/>
<MenuItem Header="Make Playable" Click="MakePlayable" />
</MenuItem>
<MenuItem Command="ApplicationCommands.Help" />
</Menu>
<StackPanel DockPanel.Dock="Bottom" Name="stackPanel1" Orientation="Horizontal" background="Yellow">
<Label Content="Playable:" Name="label1" />
<Label Name="labPlayable" />
</StackPanel>
</DockPanel>
</Window>
Then I add a an instance of the MapCanvEdit Class which inherits from Canvas in C# code as follows. As its the last child to be added to the Dockpanel it should take the remaining space in the Dockpanel. But it covers the menu and status bars as well covering the whole of the client area. To be precise it is the children of the Canvas that cover over the other two Stack Panels. Where the Canvas(MapCanvEdit) is empty you can see the Menu and Status bars:
public partial class ScenEditWnd : Window
{
ScenC scenC;
MapCanvEdit mapCanvE;
public ScenEditWnd(ScenC scenCI)
{
InitializeComponent();
scenC = scenCI;
mapCanvE = new MapCanvEdit(scenC);
mapDockP.Children.Add(mapCanvE);
MouseWheel += mapCanvE.Zoom;
mapCanvE.SizeChanged += delegate { mapCanvE.DrawHexs(); };
ContentRendered += delegate { mapCanvE.DrawHexs(); };
labPlayable.Content = scenC.playable.ToString();
}
}
I've left out the other methods for simplicity. Any help appreciated!
It's just the way Canvas works. It can place its children outside its own area. If you want it to restrict children to bounds set ClipToBounds="True" (see ClipToBounds on MSDN) or use another panel.

Resources