Saturday, February 14, 2015

How to create a custom tool item with LinsUIWPF Suite

Download   Demonstration  Question?   Contact Us

Prerequisite: Follow the link How to create a new project to create your application with LinsUIWPF Suite.

1.     Create a custom control which is derived from FlexToolBarBaseButton.
public class MyCustomToolItem : FlexToolBarBaseButton
{
}
2.     Overwrite the following virtual function
public override Size MeasureSize(bool bDropDown, FLEX_DOCKING_ALIGN nDock)
{
Size szMySize;
/////////////////////////////////////////////
// Caculate your custom tool item’s size
/////////////////////////////////////////////
return szMySize;
}
3.     Replace the original tool item with your custom tool item.
<src:FlexToolBar x:Class="Demo.BlossomToolBar"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:src="clr-namespace:LinsUIWPF;assembly=LinsUIWPF" 
ID = "{StaticResource BLOSSOM_TOOLBAR_ID}" Text="Blossom" FlexDock="LEFT" Height="44" Width="277">
<src:MyCustomToolItem CommandID="{StaticResource DOWN_COMMAND_ID}" ID = "{StaticResource BLOSSOM_DOWN_ID}" HorizontalAlignment="Left" VerticalAlignment="Top" Icon="/Demo;component/Resource/navigate_down.ico"Text="Down" ToolTipText="Tooltip for &quot;Down&quot; comment." />
</src:FlexToolBar>



References:

No comments:

Post a Comment