I want to create a multiple inkcanvases with tooltip displayes.so i want to create ink canvas class dynamically.whenever i create instance of inkcanvas class ,a new ink canvas with tool display have to be created in WPF window.
class1 mycanvas1 = new class1(" aa");
class1 mycanvas2 = new class1("bb")
The letter in the string is the text of tool tip display.can u tell me the way . I created a ink canvas usercontrol with tooltip empty text.but i unable to call this wpf user control in the above way.
here my code
namespace strokecollectio
{
class mycan : InkCanvas
{
public mycan()
{
this.Width = 300;
this.Height = 200;
}
}
}
InkCanvas Customized class with ToolTip:
[DebuggerDisplay("[{Scene}]Strokes:{Strokes.Count}, Children:{Children.Count}")]
public class InkCanvas_SandeepJadhav : InkCanvas
{
public InkCanvas_SandeepJadhav(string toolTip)
{
ToolTip = toolTip;
}
}
Inkcanvas class created dynamically.
public partial class MainWindow : Window
{
public InkCanvas_SandeepJadhav currCanvas = null;
double width = 0, height = 0, toolWindowHeight = 0;
public MainWindow()
{
InitializeComponent();
this.WindowState = System.Windows.WindowState.Maximized;
width = System.Windows.SystemParameters.WorkArea.Width;
height = System.Windows.SystemParameters.WorkArea.Height;
currCanvas = new InkCanvas_SandeepJadhav("Sandy");
currCanvas.Width = width;
currCanvas.Height = height - 150;
currCanvas.Background = (System.Windows.Media.Brush)new SolidColorBrush(Colors.Lime);
toolWindowHeight = (height / 10);
currCanvas.Margin = new Thickness(0, 0, 0, toolWindowHeight);
myGrid.Children.Add(currCanvas);
}
}
XAML Code
<Window x:Class="WpfMultiInkCanvas.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid x:Name="myGrid"></Grid>
</Window>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.