I am using Xceed.Wpf.AvalonDock in my WPF application.
I want a feature on the start page of my application which gives users an option to change the theme of the application by a click of a button/link.
Any suggestions how to do this?
Currently, I am using following code in XAML to set the Aero theme:
<avalonDock:DockingManager.Theme>
<avalonDock:AeroTheme/>
</avalonDock:DockingManager.Theme>
You can add a combo box which contains theme names, also each item's Tag is filled with its associated theme name:
<ComboBox>
<ComboBoxItem Content="Generic" />
<ComboBoxItem Content="Aero">
<ComboBoxItem.Tag>
<xcad:AeroTheme />
</ComboBoxItem.Tag>
</ComboBoxItem>
<ComboBoxItem Content="VS2010">
<ComboBoxItem.Tag>
<xcad:VS2010Theme />
</ComboBoxItem.Tag>
</ComboBoxItem>
<ComboBoxItem Content="Metro">
<ComboBoxItem.Tag>
<xcad:MetroTheme />
</ComboBoxItem.Tag>
</ComboBoxItem>
</ComboBox>
Then these tag names in items are used for binding to the Theme property in DockingManager:
<xcad:DockingManager Theme="{Binding ElementName=_themeCombo, Path=selectedItem.Tag}">
You can set the theme fix like this:
<xcad:DockingManager Grid.Row="1" MaxHeight="425"
AllowMixedOrientation="True"
BorderBrush="Black"
BorderThickness="1"
>
<xcad:DockingManager.Theme>
<xcad:MetroTheme />
</xcad:DockingManager.Theme>
</xcad:DockingManager>
You should be able to do this with a binding like any other property:
<avalonDock:DockingManager Theme="{Binding ThemeProperty}">
...
</avalonDock:DockingManager>
And then in your code just make your button or whatever control you use change ThemeProperty
Related
I have a project where I've lot a few diferent listview/gridviews itemstemplate.
yet all share the same flyout menu, something like this
<FlyoutBase.AttachedFlyout >
<MenuFlyout >
<MenuFlyoutItem x:Uid="lbl_action_sheet_title_add_to_playlist" Text="$add to playlist" />
<MenuFlyoutItem x:Uid="lbl_action_sheet_share" Text="$share" />
</MenuFlyout>
</FlyoutBase.AttachedFlyout>
And I want to reuse it not copy paste it to N templates
Any ideas?
You could use an attached behavior to attach the menu from a DataTemplate resource.
I have one simple application that have few pages.
On first page I have addMob, and that is working fine.
On that page I have a button for the contact page. When I open the contact page and return to the main page, addMob refreshes.
I do not want to do that. How can I put that first page in background without starting it again when user the returns from the contact page?
No. By design, in windows phone, you can have only one page active (visible) at a time. Ad controls will unload and refresh automatically when you navigate between pages. We have no control over this behaviour.
In my experience, I don't think we have to worry about Ads refreshing if navigation is fairly infrequent. As long as you expect the user to stay on a page for about 20 to 30 seconds on average, I would suggest not to worry about refresh. In fact, (again, in my personal experience) I receive more clicks with this implementation than having one static Ad control refreshing at a fixed interval.
But if you still have to avoid Ad refresh, here are couple of workarounds.
Option 1: Embed the "contact page" as a ContentControl/UserControl inside the Main page. Show and hide the contact control as required. Below is a very basic XAML design to demonstrate this.
<Grid>
<Grid.RowDefinition>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinition>
<AdControl Grid.Row="0" Height="80" />
<Grid Name="MainPage" Grid.Row="1">
<!-- Main page content -->
</Grid>
<view:ContactPage Name="Contacts" Grid.Row="1" Visibility="Collapsed">
<!-- Contact page content -->
</view:ContactPage>
</Grid>
Also, remember to handle BackButtonPress if you are going with this approach. The user would expect pressing back button, when the content page is visible, to take them back to Main page.
Option 2: If your application design would allow, use a Panaroma or Pivot control to show Main and Contact pages. Sample below,
<Grid>
<Grid.RowDefinition>
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinition>
<AdControl Grid.Row="0" Height="80" />
<controls:Pivot Grid.Row="1">
<controls:PivotItem Header="Main page">
<!-- Main page content -->
</controls:PivotItem>
<controls:PivotItem Header="Contacts">
<!-- Contact page content -->
</controls:PivotItem>
</controls:Pivot>
</Grid>
I'm working on aspx pages and i have asp.net Menu and CSS assigned to it.
But when I run the application the CSS class names get changed and its dynamically created as we see in controls inside "ContentPlaceHolder".
The code is
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu"
EnableViewState="False" IncludeStyleBlock="False" Orientation="Horizontal">
<DynamicItemTemplate>
<%# Eval("Text") %>
</DynamicItemTemplate>
<Items>
.
.
.
</Items>
</asp:Menu>
please check this Image what i get when i run this..
I checked my application to know whether the Menu control is placed inside content placeholder or anything. But its not.
Do anyone know how to solve this issue.
class="menu ct100..." means that this element has two classes 1:menu and 2:ct100...
and nothing is wrong with it!the ct100... is generated by asp.net and if it is different any time you run the page it's up to asp.net component and if you dont like that try not to use this built in component, that i think you should do it.
by the way the only thing is changing when using master pages is client side id, that you can avoid this from happening by code below
<asp:TextBox ID="myId" runat="server" ClientIDMode="Static"></asp:TextBox>
set ClientIDMode to Static
I have problem with contextMenu in Windows Phone. It does not appear even in the project which I have downloaded from:
http://www.geekchamp.com/articles/wp7-contextmenu-in-depth--part1-key-concepts-and-api
When I click the button from the project above nothing happens.
I was searching for the solution but I have not found. Any ideas?
Code sample which doesn't work:
<Button Content="OpenContextMenu" Height="100" Width="270">
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu VerticalOffset="50.0" IsZoomEnabled="True" x:Name="menu">
<toolkit:MenuItem Header="Add" Click="MenuItem_Click"/>
<toolkit:MenuItem Header="Update" Click="MenuItem_Click"/>
<toolkit:MenuItem Header="Delete" Click="MenuItem_Click"/>
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
</Button>
As MatDev8 has suggested, you need to "press and hold" for the context menu to appear.
anybody can help me using zk (zkoss) framework? I am new in this framework. I want to make a grid / listbox using list of jsonobject. I found no examples that can help me using list of jsonobject to create grid / listbox. I want to create simple listbox like this:
<?page title="Table of Users" contentType="text/html;charset=UTF-8"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?>
<?variable-resolver class="org.zkoss.zkplus.spring.DelegatingVariableResolver"?>
<zk>
<window id="windowUsers" width="500px" apply="${userController}" viewModel="#id('vm')">
<groupbox mold="3d">
<caption label="Table of Users" />
<listbox model="#load(vm.listUser)" width="400px">
<listhead>
<listheader label="User Id"/>
<listheader label="Name"/>
<listheader label="Address"/>
<listheader label="Phone"/>
</listhead>
<template name="model" var="list">
<listitem>
<listcell label="#load(list.id)" />
<listcell label="#load(list.name)" />
<listcell label="#load(list.address)" />
<listcell label="#load(list.phone)" />
</listitem>
</template>
</listbox>
</groupbox>
</window>
thank's in advance.
ZK is typically used as serverside pages which are evaluated by java on the server. So the example above typically renders a list of java objects on the server which is output as interactive dhtml to the browser. The diagram to explain is here.
With that in mind one would not have a list of json objects on the server; you would parse them as java objects on the server and render the java objects into the page. ZK does have "client side fusion" to be able to interact with their browser side rendering engine. That however is more of an advanced feature; you should be able to write an entire system using ZK without doing any browserside programming. Here is a demo of that but I have never used myself
(warning: shameless plug) Checkout my demo app which has a simple page which renders and edits a list of objects just like your example.
thank you for the answer, it taught me enough about ZK. I've got the way to get list of JSON object shown in listbox like this:
<listitem forEach="${userController.list}">
<listcell label="${each.id}" />
<listcell label="${each.name}" />
<listcell label="${each.address}" />
<listcell label="${each.phone}" />
</listitem>