Use styles define in application resources - wpf

I'm having problem using any styles that are defined in my Application resources in another classes. These are the contents of my App.xaml class. When I try to apply the TextBox class I get error: cannot find named resource "validationTextboxStyle"
<Application x:Class="ClientApp.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
StartupUri="LoginWindow.xaml">
<Application.Resources>
<Style x:Key="validationTextboxStyle" TargetType="TextBox">
<Setter Property="Validation.ErrorTemplate">
<Setter.Value>
<ControlTemplate>
<DockPanel LastChildFill="True">
<TextBlock DockPanel.Dock="Right"
Foreground="Orange"
FontSize="12pt">
!!!!
</TextBlock>
<Border BorderBrush="Green" BorderThickness="1">
<AdornedElementPlaceholder />
</Border>
</DockPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Application.Resources>
<Application.MainWindow>
<NavigationWindow Source="Main.xaml"></NavigationWindow>
</Application.MainWindow>
I try to use the style in another window.
<Window x:Class="ClientApp.NewItem"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:validation="clr-namespace:ClientApp.ValidationRules"
xmlns:extToolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit/extended"
Height="520" Width="400"
WindowStartupLocation="CenterOwner">
<Window.CommandBindings>
<CommandBinding Command="ApplicationCommands.Save"
CanExecute="SaveCanExecute"
Executed="SaveExecuted" />
</Window.CommandBindings>
<Window.Resources>
</Window.Resources>
<TabControl Height="Auto" Name="tabControl1" Width="Auto">
<TabItem Header="General" Name="tabItem1">
<extToolkit:BusyIndicator x:Name="busyIndicator" Visibility="Visible">
<Grid Name="contentGrid">
<extToolkit:ChildWindow Name="generateWindowChild" IsModal="True" Height="222" Width="300" WindowStartupLocation="Center" Grid.Column="0" Grid.ColumnSpan="6" Grid.Row="0" Grid.RowSpan="10">
<Grid>
<TextBox Height="23" HorizontalAlignment="Left" Margin="12,14,0,0" Name="txt_password" VerticalAlignment="Top" Width="242" />
<CheckBox Content="Numbers" IsChecked="True" Height="16" HorizontalAlignment="Left" Margin="16,79,0,0" Name="chk_numbers" VerticalAlignment="Top" />
<Button Content="Generate" Height="23" HorizontalAlignment="Left" Margin="58,152,0,0" Name="btn_generatePass" VerticalAlignment="Top" Width="75" Click="btn_generatePass_Click" />
<CheckBox Content="Upper case letters" IsChecked="True" Height="16" HorizontalAlignment="Left" Margin="16,123,0,0" Name="chk_special" VerticalAlignment="Top" />
<CheckBox Content="Special characters" IsChecked="True" Height="16" HorizontalAlignment="Left" Margin="16,101,0,0" Name="chk_upper" VerticalAlignment="Top" />
<Button Content="Insert" Height="23" HorizontalAlignment="Left" Margin="145,152,0,0" Name="btn_InsertPass" VerticalAlignment="Top" Width="75" Click="btn_InsertPass_Click" />
<extToolkit:IntegerUpDown DefaultValue="8" Value="8" Height="25" Width="35" Visibility="Visible" Margin="88,46,145,115" Name="minUpDown" PreviewKeyDown="minUpDown_PreviewKeyDown" ValueChanged="minUpDown_ValueChanged" />
<extToolkit:IntegerUpDown DefaultValue="8" Value="8" Height="25" Width="35" Margin="0,46,24,115" Name="maxUpDown" PreviewKeyDown="maxUpDown_PreviewKeyDown" ValueChanged="maxUpDown_ValueChanged" HorizontalAlignment="Right" />
<Label Content="Min length:" Height="28" HorizontalAlignment="Left" Margin="16,45,0,0" Name="minLengthLabel" VerticalAlignment="Top" />
<Label Content="Max length:" Height="28" HorizontalAlignment="Right" Margin="0,45,69,0" Name="maxLengthLabel" VerticalAlignment="Top" />
</Grid>
</extToolkit:ChildWindow>
<TextBox HorizontalAlignment="Left" Style="{StaticResource validationTextboxStyle}" VerticalAlignment="Top" Width="120" Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" LostFocus="TextBox_LostFocus">
<TextBox.Text>
<Binding Path="GroupName" UpdateSourceTrigger="LostFocus" Mode="TwoWay">
<Binding.ValidationRules><validation:ItemGroupNameValidationRule /></Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBox HorizontalAlignment="Left" Style="{StaticResource validationTextboxStyle}" VerticalAlignment="Top" Width="120" Grid.Row="3" Grid.Column="2" Grid.ColumnSpan="2" >
<TextBox.Text>
<Binding Path="Title" UpdateSourceTrigger="LostFocus" Mode="TwoWay">
<Binding.ValidationRules><validation:ItemTitleValidationRule /></Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBox HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" Grid.Row="4" Grid.Column="2" Grid.ColumnSpan="2">
<TextBox.Text>
<Binding Path="username" UpdateSourceTrigger="LostFocus" Mode="TwoWay">
<Binding.ValidationRules><validation:ItemUsernameValidationRule /></Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<PasswordBox HorizontalAlignment="Left" Name="txt_itemPassword" VerticalAlignment="Top" Width="120" Grid.Row="5" Grid.Column="2" Grid.ColumnSpan="2" LostFocus="txt_itemPassword_LostFocus" />
<PasswordBox HorizontalAlignment="Left" Name="txt_ConfirmPassword" VerticalAlignment="Top" Width="120" Grid.Row="6" Grid.Column="2" Grid.ColumnSpan="2" LostKeyboardFocus="txt_ConfirmPassword_LostKeyboardFocus" />
<Button Content="Generate" HorizontalAlignment="Left" Name="btn_generateNewPass" VerticalAlignment="Top" Width="36" Click="btn_generateNewPass_Click" Grid.Row="6" Grid.Column="4" Grid.ColumnSpan="2"/>
<TextBox HorizontalAlignment="Left" VerticalAlignment="Top" Width="120" Grid.Row="7" Grid.Column="2" Grid.ColumnSpan="2" >
<TextBox.Text>
<Binding Path="Url" UpdateSourceTrigger="LostFocus" Mode="TwoWay">
<Binding.ValidationRules><validation:ItemUrlValidationRule /></Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBox Height="80" Width="200" Background="White" VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Row="8" Grid.Column="2" Grid.ColumnSpan="6">
<TextBox.Text>
<Binding Path="Note" UpdateSourceTrigger="LostFocus" Mode="TwoWay">
<Binding.ValidationRules><validation:ItemNoteValidationRule /></Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<ListBox Height="80" HorizontalAlignment="Left" BorderBrush="LightGray" Name="listBox_Roles" VerticalAlignment="Top" Width="200" Grid.Row="9" Grid.Column="2" Grid.ColumnSpan="4">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding IsChecked}" Content="{Binding Title}" Checked="checkBoxChanged" Unchecked="checkBoxChanged"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<Label Content="Group" HorizontalAlignment="Left" Name="label9" VerticalAlignment="Top" Grid.Row="2" Grid.Column="1" />
<Label Content="Title" HorizontalAlignment="Left" Name="label1" VerticalAlignment="Top" Grid.Row="3" Grid.Column="1"/>
<Label Content="Username" HorizontalAlignment="Left" Name="label2" VerticalAlignment="Top" Grid.Row="4" Grid.Column="1"/>
<Label Content="Password" HorizontalAlignment="Left" Name="label3" VerticalAlignment="Top" Grid.Row="5" Grid.Column="1"/>
<Label Content="Confirm Password" HorizontalAlignment="Left" Name="label7" VerticalAlignment="Top" Grid.Row="6" Grid.Column="1"/>
<Label Content="Url" HorizontalAlignment="Left" Name="label5" VerticalAlignment="Top" Grid.Row="7" Grid.Column="1"/>
<Label Content="Note" HorizontalAlignment="Left" Name="label4" VerticalAlignment="Top" Grid.Row="8" Grid.Column="1"/>
<Label Content="Roles" HorizontalAlignment="Left" Name="label8" VerticalAlignment="Top" Grid.Row="9" Grid.Column="1"/>
<Button Content="Create" Command="ApplicationCommands.Save" IsDefault="True" HorizontalAlignment="Left" Name="btn_CreateItem" VerticalAlignment="Top" Width="75" Grid.Row="11" Grid.Column="2"/>
<Button Content="Cancel" HorizontalAlignment="Right" IsCancel="True" Name="btn_CancelCreateItem" VerticalAlignment="Top" Width="75" Click="btn_CancelCreateItem_Click" Grid.Row="11" Grid.Column="3" Grid.ColumnSpan="2"/>
</Grid>
</extToolkit:BusyIndicator>
</TabItem>
<TabItem Header="Expiration" Name="tabItem2">
<GroupBox Header="Expiration Rule" Height="229" Name="groupBox1" Width="469" VerticalAlignment="top" HorizontalAlignment="Left">
<Grid Height="210">
<Grid.RowDefinitions>
<RowDefinition Height="66*" />
<RowDefinition Height="144*" />
</Grid.RowDefinitions>
<RadioButton GroupName="passwordExpiration" Content="Never" IsChecked="True" Height="16" HorizontalAlignment="Left" Margin="38,22,0,0" Name="radioExpiresNever" VerticalAlignment="Top" />
<RadioButton GroupName="passwordExpiration" Content="In" Height="16" Name="radioExpiresInDays" Margin="36,65,-36,129" Grid.RowSpan="2" />
<extToolkit:IntegerUpDown Name="expiresInDaysUpDown" Margin="152,61,232,127" Height="22" Grid.RowSpan="2"></extToolkit:IntegerUpDown>
<Label Name="daysRecurring" Content="Days" Margin="231,58,0,117" HorizontalAlignment="Left" Width="38" Grid.RowSpan="2"></Label>
<RadioButton GroupName="passwordExpiration" Content="On" Height="16" HorizontalAlignment="Left" Margin="38,38,0,0" Name="radioExpiresDate" VerticalAlignment="Top" Grid.Row="1" />
<extToolkit:DateTimePicker Name="expirationDate" Width="203" Height="21" Margin="152,40,102,83" Grid.Row="1"></extToolkit:DateTimePicker>
</Grid>
</GroupBox>
</TabItem>
</TabControl>

Related

Orientation of WPF status bar and label are in wrong place when the window is maximised

In my serial port WPF application , the labels (BaudRate,Parity,DataBits and stopBit) and the StatusBar (for displaying PortStatus) are in wrong place when I maximise the window.
I would like to have suggestion from expertise to resolve my issue.
So please let me know if I can make any changes/edit on my xaml file to have these orientation on the same place as it is in Normal window mode.
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:SerialReadAndWrite"
xmlns:System="clr-namespace:System;assembly=mscorlib" x:Class="ATR220ReadAndWrite.MainWindow"
mc:Ignorable="d"
Title="ATR220ReadAndWrite" Height="450" Width="800">
<Grid Margin="0,0,-71,-107">
<ComboBox x:Name="ComPortComboBox" HorizontalAlignment="Left" Height="14" Margin="115,20,0,0" VerticalAlignment="Top" Width="98" SelectionChanged="ComPort_SelectionChanged" DropDownOpened="ComPort_DropDownOpened" VerticalContentAlignment="Stretch" IsSynchronizedWithCurrentItem="False" FontSize="9" FontFamily="Arial"/>
<Label Content="PortNumber :" HorizontalAlignment="Left" Margin="21,14,0,0" VerticalAlignment="Top"/>
<Label Content="PortSettings :" HorizontalAlignment="Left" Margin="21,58,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.546,3.143" FontSize="10" FontFamily="Arial"/>
<Image HorizontalAlignment="Left" Height="26" Margin="359,14,0,0" VerticalAlignment="Top" Width="29" RenderTransformOrigin="-0.23,0.36"/>
<ComboBox x:Name="BaudRateComboBox" HorizontalAlignment="Left" Margin="115,84,0,0" VerticalAlignment="Top" Width="98" Height="17" SelectionChanged="BaudRate_SelectionChanged" IsEnabled="False" IsReadOnly="True" FontSize="9" FontFamily="Arial">
<System:String>115200</System:String>
<System:String>57600</System:String>
<System:String>38400</System:String>
<System:String>19200</System:String>
<System:String>14400</System:String>
<System:String>9600</System:String>
<System:String>4800</System:String>
</ComboBox>
<ComboBox x:Name="ParityComboBox" HorizontalAlignment="Left" Height="17" Margin="308,86,0,0" VerticalAlignment="Top" Width="98" SelectionChanged="Parity_SelectionChanged" IsEnabled="False" FontSize="9" FontFamily="Arial">
<System:String>Even</System:String>
<System:String>Mark</System:String>
<System:String>None</System:String>
<System:String>Odd</System:String>
<System:String>Space</System:String>
</ComboBox>
<ComboBox x:Name="DataBitsComboBox" HorizontalAlignment="Left" Height="17" Margin="115,125,0,0" VerticalAlignment="Top" Width="98" SelectionChanged="DataBits_SelectionChanged" IsEnabled="False" FontSize="8" FontFamily="Arial">
<System:String>5</System:String>
<System:String>6</System:String>
<System:String>7</System:String>
<System:String>8</System:String>
</ComboBox>
<ComboBox x:Name="StopBitsComboBox" HorizontalAlignment="Left" Height="17" Margin="308,123,0,0" VerticalAlignment="Top" Width="98" SelectionChanged="StopBits_SelectionChanged" IsEnabled="False" FontSize="10" FontFamily="Arial">
<System:String>One</System:String>
<System:String>Two</System:String>
<System:String>OnePointFive</System:String>
</ComboBox>
<Label Content="Baudrate :" HorizontalAlignment="Center" Margin="47,81,753,423" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" Height="22" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="10" FontStyle="Italic" Width="63"/>
<Label Content="Parity :" HorizontalAlignment="Center" Margin="234,81,573,423" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" Height="22" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="10" FontStyle="Italic" Width="56"/>
<Label Content="DataBits :" HorizontalAlignment="Center" Margin="48,123,753,382" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" Height="22" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="10" FontStyle="Italic" Width="62"/>
<Label Content="StopBit :" HorizontalAlignment="Center" Margin="238,123,567,382" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" Height="22" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" FontSize="10" FontStyle="Italic" Width="58"/>
<Button x:Name="ConnectButton" Content="Connect" HorizontalAlignment="Left" Margin="308,20,0,0" VerticalAlignment="Top" Width="75" Click="ConnectButton_Click" IsEnabled="False" Height="14" FontSize="10" FontFamily="Arial"/>
<Label Content="ProtocolCustomWndow :" HorizontalAlignment="Left" Margin="21,172,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.546,3.143" FontSize="10" FontFamily="Arial"/>
<ComboBox x:Name="ProtocolTypeComboBox" HorizontalAlignment="Left" Height="14" Margin="141,177,0,0" VerticalAlignment="Top" Width="98" SelectionChanged="ProtocolTypeComboBox_SelectionChanged" VerticalContentAlignment="Stretch" IsReadOnly="True" IsSynchronizedWithCurrentItem="True" FontSize="9" FontFamily="Arial" IsEnabled="False">
<System:String>WLink</System:String>
</ComboBox>
***<StatusBar HorizontalAlignment="Left" Height="28" Margin="0,396,0,0" VerticalAlignment="Top" Width="794">
<StatusBarItem FontSize="9" FontFamily="Arial" TextOptions.TextHintingMode="Fixed">
<TextBlock Name= "PortStatus"/>
</StatusBarItem>
</StatusBar>***
</Grid>
</Window>
Images of the correct and wrong pics are attached.
wrong position
Wrong Position
Correct position
Correct position
Try something like this:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="PortNumber :" HorizontalAlignment="Center"/>
<ComboBox FontSize="9" FontFamily="Arial" Grid.Column="1">
<ComboBoxItem IsSelected="True">COM 3</ComboBoxItem>
</ComboBox>
<Button Content="Connect" Grid.Row="0" Grid.Column="3"></Button>
<TextBlock Text="PortSettings :" FontSize="10" FontFamily="Arial" Grid.Row="1" HorizontalAlignment="Center"/>
<TextBlock Text="Baudrate :" FontStyle="Italic" Grid.Row="2" HorizontalAlignment="Center"/>
<ComboBox IsEnabled="False" IsReadOnly="True" FontSize="9" FontFamily="Arial" Grid.Row="2" Grid.Column="1">
<System:String>115200</System:String>
<System:String>57600</System:String>
<System:String>38400</System:String>
<System:String>19200</System:String>
<System:String>14400</System:String>
<System:String>9600</System:String>
<System:String>4800</System:String>
</ComboBox>
<TextBlock Text="Parity :" Grid.Column="2" Grid.Row="2" HorizontalAlignment="Center"/>
<ComboBox Grid.Row="2" Grid.Column="3"/>
</Grid>
Pay special attention to use of Grid.Row and Grid.Column, you will need to set the Horizontal Alignment on these elements but this will show you how to position things in WPF.

xceed IntegerUpdown's TabIndex has no effect

I have 4 IntegerUpDowns from the Xceed toolkit. The problem is that the navigation through Tab button does not work at all. I set TabIndex, TabStop properties, but no effect. Maybe somebody had this problem? Any help will be appreciate! Thanks a lot!
Here is a code:
<GroupBox Margin="20"
HorizontalAlignment="Center"
Header="groupbox header text">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0"
Margin="7"
Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" Text="text1:" />
<xctk:IntegerUpDown Name="updown1"
Width="50"
Height="25"
Margin="17,0,30,0"
TabIndex="0"
IsTabStop="True"
VerticalAlignment="Center"
Increment="1"
PreviewKeyDown="NumericUpDown_OnPreviewKeyDown"
ValueChanged="Updown1_OnValueChanged"
Value="{Binding Property1,
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}" />
<TextBlock VerticalAlignment="Center" Text="text2" />
<xctk:IntegerUpDown Name="updown2"
Width="50"
Height="25"
Margin="43,0,0,0"
VerticalAlignment="Center"
Increment="2"
TabIndex="2"
IsTabStop="True"
PreviewKeyDown="NumericUpDown_OnPreviewKeyDown"
Value="{Binding Property2,
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
<StackPanel Grid.Row="1"
Margin="7,0,7,7"
Orientation="Horizontal">
<TextBlock VerticalAlignment="Center" Text="text3:" />
<xctk:IntegerUpDown Name="updown3"
Width="50"
Height="25"
Margin="7,0,30,0"
VerticalAlignment="Center"
Increment="1"
TabIndex="1"
IsTabStop="True"
PreviewKeyDown="NumericUpDown_OnPreviewKeyDown"
ValueChanged="Updown3_OnValueChanged"
Value="{Binding Proeprty3,
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}" />
<TextBlock VerticalAlignment="Center" Text="text4:"/>
<xctk:IntegerUpDown Name="updown4"
Width="50"
Height="25"
Margin="7,0,0,0"
TabIndex="3"
VerticalAlignment="Center"
Increment="1"
IsTabStop="True"
PreviewKeyDown="NumericUpDown_OnPreviewKeyDown"
Value="{Binding Property4,
Mode=TwoWay,
UpdateSourceTrigger=PropertyChanged}" />
</StackPanel>
</Grid>
</GroupBox>

Textbox Border Not Showing - WPF

The textbox top and bottom border is not showing.
I have provided the entire XAML code for the main window. I have tried increasing the BorderThickness and also changed the BorderBrush. That did not work.
XAML:
<Window x:Class="WpfApplication6.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApplication6"
mc:Ignorable="d"
Title="Activation Window" Height="300" Width="518.797">
<Grid>
<TextBox x:Name="txtFirstDigit" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap" VerticalAlignment="Center" Width="45" Margin="23,171,0,76" BorderThickness="1" BorderBrush="Black" />
<TextBox x:Name="txtSecondDigit" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap" VerticalAlignment="Center" Width="45" Margin="81,171,0,76"/>
<TextBox x:Name="txtThirdDigit" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap" VerticalAlignment="Center" Width="45" Margin="138,171,0,76"/>
<TextBox x:Name="txtFourthDigit" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap" VerticalAlignment="Center" Width="45" Margin="195,171,0,76"/>
<TextBox x:Name="txtFifthDigit" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap" VerticalAlignment="Center" Width="45" Margin="252,171,0,76"/>
<Label x:Name="label" Content="Product key:" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="23,142,0,0"/>
<TextBox x:Name="txtFirstDigit_Copy" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap" VerticalAlignment="Center" Width="274" Margin="23,111,0,136" />
<Label x:Name="label_Copy" Content="Email:" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="23,81,0,0"/>
<TextBox x:Name="txtFirstDigit_Copy1" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap" VerticalAlignment="Center" Width="130" Margin="23,55,0,192" />
<Label x:Name="label_Copy1" Content="First Name:" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="23,25,0,0"/>
<TextBox x:Name="txtFirstDigit_Copy2" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap" VerticalAlignment="Center" Width="130" Margin="167,55,0,192" />
<Button x:Name="button" Content="Next" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="142,220,0,0"/>
<Button x:Name="button1" Content="Cancel" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="222,220,0,0" Click="button1_Click"/>
<TextBlock x:Name="textBlock" HorizontalAlignment="Left" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Margin="350,147,0,0"/>
</Grid>
</Window>
I'd try something like this:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
</Grid.RowDefinitions>
<Label x:Name="label_Copy1" Grid.Row="0" Content="First Name:" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="23,0,0,0" />
<StackPanel Orientation="Horizontal" Grid.Row="1">
<TextBox x:Name="txtFirstDigit_Copy1" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap" VerticalAlignment="Center" Width="130" Margin="23,0,0,0" />
<TextBox x:Name="txtFirstDigit_Copy2" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap" VerticalAlignment="Center" Width="130" Margin="11.5,0,0,0" />
</StackPanel>
<Label x:Name="label_Copy" Grid.Row="2" Content="Email:" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="23,0,0,0" />
<TextBox x:Name="txtFirstDigit_Copy" Grid.Row="3" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap" VerticalAlignment="Center" Width="270" Margin="23,0,0,0" />
<Label x:Name="label" Grid.Row="4" Content="Product key:" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="23,0,0,0" />
<StackPanel Orientation="Horizontal" Grid.Row="5">
<TextBox x:Name="txtFirstDigit" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap" VerticalAlignment="Center" Width="45" Margin="23,0,0,0" BorderThickness="1" />
<TextBox x:Name="txtSecondDigit" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap" VerticalAlignment="Center" Width="45" Margin="11.5,0,0,0" />
<TextBox x:Name="txtThirdDigit" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap" VerticalAlignment="Center" Width="45" Margin="11.5,0,0,0" />
<TextBox x:Name="txtFourthDigit" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap" VerticalAlignment="Center" Width="45" Margin="11.5,0,0,0" />
<TextBox x:Name="txtFifthDigit" HorizontalAlignment="Left" Height="22" TextWrapping="Wrap" VerticalAlignment="Center" Width="45" Margin="11.5,0,0,0" />
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="6">
<Button x:Name="button" Content="Next" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="132,0,0,0" />
<Button x:Name="button1" Content="Cancel" HorizontalAlignment="Left" VerticalAlignment="Top" Width="75" Margin="11.5,0,0,0" />
</StackPanel>
</Grid>

ListBoxItem Should be Visible while Draging From one ListBox to another in WPF

Click Here to View ImageI am implementing Drag& Drop in wpf. I want when i dragged ListBoxItem From one Listbox to another. that listboxitem should be visible while dragging.Do i missing Something ?
XAML
<Grid x:Name="MainGrid" Width="{Binding ElementName=ProjectWindow,Path=ActualWidth}" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="19*" />
<ColumnDefinition Width="283*" />
<ColumnDefinition Width="59*" />
<ColumnDefinition Width="19*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="7*" />
<RowDefinition Height="83*" />
</Grid.RowDefinitions>
<Canvas Grid.Row="0" >
<Label Content="TM" FontSize="14" Foreground="White" FontFamily="segoe_uilight" Canvas.Left="118" Canvas.Top="-4"></Label>
<Label Content="smart" FontSize="26" Foreground="White" FontFamily="segoe_uilight"></Label>
<Label Content="Project" FontSize="26" Foreground="White" FontFamily="segoe_uilight" Canvas.Left="64" FontWeight="Bold"></Label>
<TextBlock Canvas.Left="164" Canvas.Top="15" Background="Black">
<Label Background="Black" Content="From" FontSize="12" Foreground="White" FontFamily="segoe_uilight" Canvas.Left="164" Canvas.Top="15" ></Label>
<DatePicker x:Name="StartDate" Width="100" Background="Black" Canvas.Left="204" Canvas.Top="15"></DatePicker>
<Label Background="Black" Content="Till" FontSize="12" Foreground="White" FontFamily="segoe_uilight" Canvas.Left="315" Canvas.Top="15" ></Label>
<DatePicker x:Name="EndDate" Width="100" Background="Black" Canvas.Left="344" Canvas.Top="15"></DatePicker>
<Label Background="Black" Content="My Activities" FontSize="12" Foreground="White" FontFamily="segoe_uilight" Canvas.Left="315" Canvas.Top="15" ></Label>
<CheckBox x:Name="ChckBoxMyActivities" Click="ChckBoxMyActivities_Click_1" Background="Black" Margin="0,0,0,5" Width="20"></CheckBox>
<Label Background="Black" Content="Project Component" FontSize="12" Foreground="White" FontFamily="segoe_uilight" Canvas.Left="315" Canvas.Top="15" ></Label>
<ComboBox x:Name="ComboBoxSubProjects" SelectionChanged="ComboBoxSubProjects_SelectionChanged_1" Background="Black" Margin="0,0,0,5" Width="100" ></ComboBox>
</TextBlock>
<Expander HorizontalAlignment="Right" FlowDirection="RightToLeft" Foreground="White" FontFamily="segoe_uilight" Width="200px" Canvas.Top="1" Canvas.Right="200" Canvas.Left="{Binding Source={x:Static SystemParameters.PrimaryScreenWidth}}" BorderBrush="#FF0A0909" BorderThickness="1,1,1,2" Background="#BF080707" Panel.ZIndex="99999">
<Expander.Header>
<StackPanel Orientation="Horizontal">
<Canvas Height="22" Width="172px" VerticalAlignment="Bottom">
<Label x:Name="LoginUserName" Margin="0px 0 0 0" HorizontalAlignment="Left" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0"></Label>
<Image Source="img\icons\dropdown_user.png" Height="20px" Width="20px" RenderTransformOrigin="2.75,0.8" Canvas.Left="117" />
</Canvas>
</StackPanel>
</Expander.Header>
<!--<Expander.Content>
<TextBox Text="LoginUserName"></TextBox>
</Expander.Content>-->
<StackPanel Margin="10,4,0,0" >
<StackPanel Orientation="Horizontal">
<Label x:Name="lblSettings" Margin="49px 0 31px 0" HorizontalAlignment="Left" Content="Settings" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0" RenderTransformOrigin="2.019,0.625">
</Label>
<Image Source="img\icons\setting.png" Height="20px" Width="20px" />
</StackPanel>
<!--<Label Margin="4" Content="Logout" />-->
<!--<Button x:Name="btnLogout" Margin="4" Content="Logout" Click="btnLogout_Click_1"></Button>-->
<StackPanel Orientation="Horizontal">
<Label x:Name="btnLogout" HorizontalAlignment="Left" Margin="54px 0 31px 0" Content="Logout" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0">
</Label>
<Image Source="img\icons\logout.png" Height="20px" Width="20px" />
</StackPanel>
</StackPanel>
</Expander>
</Canvas>
<Canvas Grid.Column="0" Grid.Row="1" Background="Orange">
<StackPanel Canvas.Left="10" Background="Gray" Width="60" >
<Image Source="img\icons\information.png" Height="20px" Width="20px" />
<Label HorizontalAlignment="Center" Content="Info" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0" >
</Label>
</StackPanel>
<StackPanel Canvas.Left="10" Canvas.Top="45" Background="Gray" Width="60" >
<Image Source="img\icons\Scheme.png" Height="20px" Width="20px" />
<Label HorizontalAlignment="Center" Content="Schema" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0" >
</Label>
</StackPanel>
<StackPanel Canvas.Left="10" Canvas.Top="90" Background="Gray" Width="60" >
<Image Source="img\icons\Tavala.png" Height="20px" Width="20px" />
<Label HorizontalAlignment="Center" Content="Tavla" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0" >
</Label>
</StackPanel>
</Canvas>
<Canvas x:Name="gd" Grid.Column="1" Grid.Row="1" Panel.ZIndex="-1" Background="Orange">
<Grid Width="{Binding ElementName=gd, Path=ActualWidth}" Panel.ZIndex="-1">
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<Canvas Grid.Column="1" Grid.Row="0" >
<Canvas x:Name="MainCanvas" Width="{Binding ElementName=gd,Path=ActualWidth}" >
<ListBox Height="{Binding ElementName=gd,Path=ActualHeight}" Width="{Binding ElementName=gd,Path=ActualWidth}" BorderThickness="0" >
<ListBoxItem>
<ListBox Loaded="icTodoList_Loaded_1" Background="Azure" SelectionChanged="icTodoList_SelectionChanged_1" Name="icTodoList" Height="50" Width="{Binding ElementName=gd,Path=ActualWidth}" >
<ListBox.ItemTemplate>
<DataTemplate>
<ListBox x:Name="Phases" BorderThickness="0">
<ListBoxItem>
<Canvas x:Name="PhaseCanvas" Height="20" Width="200" Margin="0,0,20,20" >
<StackPanel Orientation="Horizontal">
<TextBlock x:Name="txtPhaseID" TextAlignment="Center" FontWeight="Light" HorizontalAlignment="Center" FontSize="16" Foreground="Black" FontFamily="segoe_uilight" Text="{Binding PhaseTitle}" Height="20" Width="140" />
<Image Margin="20,0,0,0" Tag="{Binding PhaseID}" Source="img\icons\add_btn.png" Width="20" Height="15" MouseUp="Image_MouseUp_1"></Image>
<!--<TextBlock HorizontalAlignment="Left" FontFamily="segoe_uilight" FontStyle="Italic" Text="{Binding UserName}" Height="20" Width="180" />
<TextBlock TextWrapping="Wrap" HorizontalAlignment="Left" FontFamily="segoe_uilight" Text="{Binding ThreadDescription}" Height="45" Width="200" />-->
</StackPanel>
</Canvas>
</ListBoxItem>
</ListBox>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</ListBoxItem>
<ListBoxItem>
<ListBox Loaded="ActivityListBox_Loaded_1" Background="Orange" Name="ActivityListBox" Height="{Binding ElementName=gd,Path=ActualHeight}" Width="{Binding ElementName=gd,Path=ActualWidth}" BorderThickness="0" >
<ListBox.ItemTemplate>
<DataTemplate>
<ListBox x:Name="InnerActivityListBox" Tag="{Binding PhaseID}" Width="225" Height="{Binding ElementName=gd,Path=ActualHeight}" Background="Orange" PreviewMouseLeftButtonDown="InnerActivityListBox_PreviewMouseLeftButtonDown_1" AllowDrop="True" DragEnter="InnerActivityListBox_DragEnter_1" Drop="InnerActivityListBox_Drop_1" DragOver="InnerActivityListBox_DragOver_1" BorderThickness="0">
<!--<ListBoxItem>-->
<!--<Canvas x:Name="ActivityCanvas" Width="200" Height="70" Background="White" >
<StackPanel Orientation="Vertical">
<TextBlock HorizontalAlignment="Left" FontWeight="Bold" Height="70" Width="10" Background="{Binding ColorDefination}" Margin="0"></TextBlock>
<TextBlock Margin="30,-70,0,0" Text="{Binding ActivityTitle}" FontWeight="Bold" ></TextBlock>
<TextBlock Margin="30,-60,0,0" Text="{Binding ProjectComponentTitle}" ></TextBlock>
<TextBlock Margin="30,-40,0,0" Text="1 Jan-3Mar" ></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" >
<Image Name="imgDesc" MouseUp="imgDesc_MouseUp_1" Source="img/icons/icon.png" Margin="20,50,0,0" Canvas.Left="15" Canvas.Top="50"></Image>
<Image Name="imgComments" MouseUp="imgComments_MouseUp_1" Source="img/icons/icon_1.png" Margin="20,50,0,0" Canvas.Left="45" Canvas.Top="50"></Image>
<Image Name="imgMembers" MouseUp="imgMembers_MouseUp_1" Source="img/icons/icon_2.png" Margin="20,50,0,0" Canvas.Left="75" Canvas.Top="50"></Image>
<Image Name="imglinks" MouseUp="imglinks_MouseUp_1" Source="img/icons/t3.png" Margin="20,50,0,0" Canvas.Left="105" Canvas.Top="50"></Image>
</StackPanel>
</Canvas>-->
<!--</ListBoxItem>-->
</ListBox>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>
</ListBoxItem>
</ListBox>
<!--<ListBox Loaded="ActivityListBox_Loaded_1" Name="ActivityListBox" Height="{Binding ElementName=gd,Path=ActualHeight}" Canvas.Top="100" Width="{Binding ElementName=gd,Path=ActualWidth}" Background="Orange">
<ListBox.ItemTemplate >
<DataTemplate>
<ListBox x:Name="InnerActivityListBox">
<ListBoxItem>
<Canvas x:Name="ActivityCanvas" Width="200" Height="70" Background="White" >
<StackPanel Orientation="Vertical">
<TextBlock HorizontalAlignment="Left" FontWeight="Bold" Height="70" Width="10" Background="{Binding ColorDefination}" Margin="0"></TextBlock>
<TextBlock Margin="30,-70,0,0" Text="{Binding ActivityTitle}" FontWeight="Bold" ></TextBlock>
<TextBlock Margin="30,-60,0,0" Text="{Binding ProjectComponentTitle}" ></TextBlock>
<TextBlock Margin="30,-40,0,0" Text="1 Jan-3Mar" ></TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" >
<Image Name="imgDesc" MouseUp="imgDesc_MouseUp_1" Source="img/icons/icon.png" Margin="20,50,0,0" Canvas.Left="15" Canvas.Top="50"></Image>
<Image Name="imgComments" MouseUp="imgComments_MouseUp_1" Source="img/icons/icon_1.png" Margin="20,50,0,0" Canvas.Left="45" Canvas.Top="50"></Image>
<Image Name="imgMembers" MouseUp="imgMembers_MouseUp_1" Source="img/icons/icon_2.png" Margin="20,50,0,0" Canvas.Left="75" Canvas.Top="50"></Image>
<Image Name="imglinks" MouseUp="imglinks_MouseUp_1" Source="img/icons/t3.png" Margin="20,50,0,0" Canvas.Left="105" Canvas.Top="50"></Image>
</StackPanel>
</Canvas>
</ListBoxItem>
</ListBox>
</DataTemplate>
</ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True" Orientation="Vertical" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
</ListBox>-->
<!--<Canvas Width="200" Height="50" Background="White" Canvas.Left="46" Canvas.Top="10">
<TextBlock FontWeight="Bold" Height="50" Width="10" Canvas.Left="0" Background="Gray"></TextBlock>
<TextBlock Text="Header Style" FontWeight="Bold" Canvas.Top="2" Canvas.Left="15"></TextBlock>
<TextBlock Text="Schedule" Canvas.Top="14" Canvas.Left="15"></TextBlock>
<TextBlock Text="1 Jan-3Mar" Canvas.Top="7" Canvas.Left="110"></TextBlock>
<Image Source="img/icons/icon.png" Canvas.Left="15" Canvas.Bottom="5"></Image>
<Image Source="img/icons/icon_1.png" Canvas.Left="45" Canvas.Bottom="5"></Image>
<Image Source="img/icons/icon_2.png" Canvas.Left="75" Canvas.Bottom="5"></Image>
<Image Source="img/icons/t3.png" Canvas.Left="105" Canvas.Bottom="5"></Image>
</Canvas>-->
</Canvas>
</Canvas>
</Grid>
</Canvas>
<Canvas x:Name="cn" Grid.Column="2" Grid.Row="1" Background="White" MouseUp="Canvas_MouseUp_1">
<!--`ActivityInfo Popup up-->
<Canvas x:Name="ActivityInfo" Background="Green" Height="{Binding ElementName=cn,Path=ActualHeight}" MouseUp="ActivityInfo_MouseUp_1" Visibility="Hidden">
<TextBlock x:Name="projectdescrption" Foreground="#FFF3800C" FontFamily="segoe_uilight" FontSize="18" Text="Information" Canvas.Left="10" ></TextBlock>
<Canvas Background="White" Height="900" Width="200" Canvas.Top="50" Canvas.Left="10">
<StackPanel Width="200" Height="900" Background="White" Orientation="Vertical" >
<TextBlock x:Name="ActivityTitle" Text="Title" FontFamily="segoe_uilight" FontSize="18" Foreground="Black"></TextBlock>
<TextBlock x:Name="txtActivityTitle" Text="Page Design" FontFamily="segoe_uilight" FontSize="12" Foreground="Black"></TextBlock>
<TextBlock x:Name="ProjectCompnt" Text="Project Component" FontFamily="segoe_uilight" FontSize="18" Foreground="Black" Margin="0,20,0,0"></TextBlock>
<TextBlock x:Name="txtProjectCompnt" Text="Project Component Design" FontFamily="segoe_uilight" FontSize="12" Foreground="Black"></TextBlock>
<TextBlock x:Name="Phase" Text="Phase" FontFamily="segoe_uilight" FontSize="18" Foreground="Black" Margin="0,20,0,0"></TextBlock>
<TextBlock x:Name="txtPhase" Text="Phase Design" FontFamily="segoe_uilight" FontSize="12" Foreground="Black"></TextBlock>
<TextBlock x:Name="Start" Text="Start" FontFamily="segoe_uilight" FontSize="18" Foreground="Black" Margin="0,20,0,0"></TextBlock>
<TextBlock x:Name="txtStart" Text="2014-1-16" FontFamily="segoe_uilight" FontSize="12" Foreground="Black"></TextBlock>
<TextBlock x:Name="End" Text="End" FontFamily="segoe_uilight" FontSize="18" Foreground="Black" Margin="0,20,0,0"></TextBlock>
<TextBlock x:Name="txtEnd" Text="2014-2-16" FontFamily="segoe_uilight" FontSize="12" Foreground="Black"></TextBlock>
<TextBlock x:Name="Activitydescrption" Foreground="Black" FontFamily="segoe_uilight" FontSize="18" Text="Description" Margin="0,20,0,0"></TextBlock>
<TextBlock x:Name="txtActivitydescrption" HorizontalAlignment="Left" Text="Loresum lipsum Loresum lipsum Loresum lipsum lipsum Loresum lipsum lipsum Loresum lipsum" Height="70" Width="180" FontFamily="segoe_uilight" TextWrapping="Wrap" Margin="0,0,0,0" FontSize="12" Foreground="Black"></TextBlock>
<TextBlock x:Name="ActivityRequirement" Foreground="Black" FontFamily="segoe_uilight" FontSize="18" Text="Requirement" Margin="0,20,0,0"></TextBlock>
<TextBlock x:Name="txtActivityRequirement" HorizontalAlignment="Left" Text="Loresum lipsum Loresum lipsum Loresum lipsum lipsum Loresum lipsum lipsum Loresum lipsum" Height="70" Width="180" FontFamily="segoe_uilight" TextWrapping="Wrap" Margin="0,0,0,0" FontSize="12" Foreground="Black"></TextBlock>
<Button x:Name="btnsave" Content="Save" Foreground="Black" Height="30" Width="100" HorizontalAlignment="Right" Background="#FFF3800C"></Button>
</StackPanel>
</Canvas>
</Canvas>
<!--`Activity Comments-->
<Canvas x:Name="Comments" Background="White" Height="{Binding ElementName=cn,Path=ActualHeight}" MouseUp="Comments_MouseUp_1" Visibility="Hidden">
<TextBlock x:Name="ActivityComments" Foreground="#FFF3800C" FontFamily="segoe_uilight" FontSize="23" Text="Comments" Canvas.Left="35"></TextBlock>
<TextBox x:Name="txtComments" Height="110" Width="200" BorderBrush="Black" TextWrapping="Wrap" Canvas.Top="40" Canvas.Left="5" VerticalScrollBarVisibility="Visible" AcceptsReturn="True"></TextBox>
<Button x:Name="btnsavecomments" Content="Send" Foreground="Black" Height="30" Width="100" Canvas.Top="170" Canvas.Left="35" Background="#FFF3800C"></Button>
<ListBox Canvas.Top="220" BorderBrush="White">
<ListBoxItem>
<!--<ListBox.ItemTemplate>
<DataTemplate>-->
<Canvas Width="220" Height="620">
<StackPanel Width="200" Height="Auto" Canvas.Top="20" Orientation="Vertical" >
<Border BorderThickness="2,2,2,2" CornerRadius="4" Background="#E26806">
<TextBlock x:Name="txtthreadComments" Height="Auto" Width="190" TextWrapping="Wrap" Background="#E26806" Text="g rg rg r g rg rg rg rg er gre ger ger g g gr" Foreground="White" ></TextBlock>
</Border>
<Image x:Name="imgthread" Height="30" Width="30" Margin="-100,-12,0,0" Source="D:\Amrit\Working Code\smart Info WPF app\SmartInfo\SmartAccount\SmartAccount\img\tol_tip.jpg"></Image>
<TextBlock x:Name="threadtime" Text="2014-6-7 12:00" HorizontalAlignment="Stretch" Margin="0,0,10,0" FontStyle="Italic" Height="20" Width="150" Foreground="Black" FontSize="16"></TextBlock>
<TextBlock x:Name="threadPostedBy" Text="Amrit Verma" Height="20" Width="150" Foreground="Black" FontStyle="Italic" FontWeight="Bold" FontSize="15"></TextBlock>
</StackPanel>
</Canvas>
</ListBoxItem>
<!--</DataTemplate>
</ListBox.ItemTemplate>-->
</ListBox>
</Canvas>
<!-- Assigned Memebres -->
<Canvas x:Name="AssignedMemebres" Background="White" Height="{Binding ElementName=cn,Path=ActualHeight}" Visibility="Hidden">
<TextBlock x:Name="Memebres" Foreground="#FFF3800C" FontFamily="segoe_uilight" FontSize="18" Text="Assigned Members" Canvas.Left="30"></TextBlock>
<ListBox Canvas.Top="40" BorderBrush="White">
<ListBoxItem>
<!--<ListBox.ItemTemplate>
<DataTemplate>-->
<Canvas Width="220" Height="620">
<TextBlock x:Name="AssignMemeber" Foreground="Black" FontFamily="segoe_uilight" FontSize="14" Text="+ Assign Memeber" FontStyle="Italic" Canvas.Left="12" Canvas.Top="-3"></TextBlock>
<StackPanel Width="200" Height="Auto" Canvas.Top="20" Orientation="Vertical" Canvas.Left="20">
<TextBlock FontFamily="segoe_uilight" FontSize="16" x:Name="txtassignedto" Text="Amrit Verma" FontWeight="Bold"></TextBlock>
<TextBlock FontFamily="segoe_uilight" FontSize="16" x:Name="txtassignedrole" Text="Developer" ></TextBlock>
<TextBlock FontFamily="segoe_uilight" FontSize="12" x:Name="Email" Text="Email" Margin="0,10,0,0"></TextBlock>
<TextBlock FontFamily="segoe_uilight" FontSize="14" x:Name="txtEmail" Text="Amrit#gmail.com" FontStyle="Italic"></TextBlock>
<TextBlock FontFamily="segoe_uilight" FontSize="12" x:Name="Phone" Text="Phone" Margin="0,10,0,0"></TextBlock>
<TextBlock FontFamily="segoe_uilight" FontSize="14" x:Name="txtPhone" Text="555-111 442 213" FontStyle="Italic"></TextBlock>
<TextBlock FontFamily="segoe_uilight" FontSize="12" x:Name="WorkingHours" Text="Working Hours" Margin="0,10,0,0"></TextBlock>
<TextBlock FontFamily="segoe_uilight" FontSize="14" x:Name="txtWorkingHours" Text="9:00 - 12:00" FontStyle="Italic"></TextBlock>
<TextBlock FontFamily="segoe_uilight" FontSize="12" x:Name="WorkingDays" Text="Working Days" Margin="0,10,0,0"></TextBlock>
<TextBlock FontFamily="segoe_uilight" FontSize="14" x:Name="txtWorkingDays" Text="Mon-Sat" FontStyle="Italic"></TextBlock>
</StackPanel>
</Canvas>
</ListBoxItem>
<!--</DataTemplate>
</ListBox.ItemTemplate>-->
</ListBox>
</Canvas>
</Canvas>
<Canvas Grid.Column="3" Grid.Row="1" Background="Orange" >
<StackPanel Canvas.Left="0" Background="Gray" Width="60" MouseUp="StackPanel_MouseUp_1" x:Name="stackpnlinfo">
<Image Source="img\icons\icon.png" Height="20px" Width="20px" />
<!--<Image Source="img\btn_img.jpg" Height="45px" Width="60px" />-->
<Label HorizontalAlignment="Center" Content="Info" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0" ></Label>
</StackPanel>
<StackPanel Canvas.Left="0" Canvas.Top="45" Background="Gray" Width="60" MouseUp="StackPanel_MouseUp_2" x:Name="stackpnlcomment">
<Image Source="img\icons\icon_1.png" Height="20px" Width="20px" />
<Label HorizontalAlignment="Center" Content="Comments" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0" >
</Label>
</StackPanel>
<StackPanel Canvas.Left="0" Canvas.Top="90" Background="Gray" Width="60" >
<Image Source="img\icons\icon_2.png" Height="20px" Width="20px" />
<Label HorizontalAlignment="Center" Content="Files" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0" >
</Label>
</StackPanel>
<StackPanel Canvas.Left="0" Canvas.Top="135" Background="Gray" Width="60" x:Name="AssignedMembrs" MouseUp="AssignedMembrs_MouseUp_1">
<Image Source="img\icons\at.png" Height="20px" Width="20px" />
<Label HorizontalAlignment="Center" Content="Assigned Members" Foreground="White" FontFamily="segoe_uilight" BorderThickness="0" >
</Label>
</StackPanel>
</Canvas>
</Grid>
c#
private void InnerActivityListBox_PreviewMouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
{
ListBox Phaseitem = (ListBox)sender as ListBox;
if (_dragged != null)
return;
UIElement element = Phaseitem.InputHitTest(e.GetPosition(Phaseitem)) as UIElement;
while (element != null)
{
if (element is ListBoxItem)
{
_dragged = (ListBoxItem)element;
break;
}
element = VisualTreeHelper.GetParent(element) as UIElement;
}
SourcePhaseID = Phaseitem.Tag.ToString();
Globallb = Phaseitem;
Globallbi = _dragged;
Phaseitem.Items.Remove(_dragged);
}
private void InnerActivityListBox_DragEnter_1(object sender, DragEventArgs e)
{
if (_dragged == null || e.Data.GetDataPresent(DataFormats.Text, true) == false)
e.Effects = DragDropEffects.None;
else
e.Effects = DragDropEffects.All;
}
private void InnerActivityListBox_Drop_1(object sender, DragEventArgs e)
{
ListBox Phaseitem = (ListBox)sender as ListBox;
DestinationPhaseID = Phaseitem.Tag.ToString();
Phaseitem.Items.Add(_dragged);
}
private void InnerActivityListBox_DragOver_1(object sender, DragEventArgs e)
{
e.Effects = DragDropEffects.Move;
}
If this is you are trying to achieve. This also include designing your own Adorner to be shown as Ghost Perview while dragging
http://www.codeproject.com/Articles/43702/Drag-and-Drop-in-WPF-Part-II
and this article has vanilla code and doing exactly what you want
http://www.essentialobjects.com/doc/5/controls/treeview/dragdrop.aspx#list_box

WPF Labels 2-n in StackPanel not visible

I am going through the tutorial here and for whatever reason, the labels for FirstName, LastName, and City are not visible, neither at design time nor at runtime. I've tried deleting them and re-adding and I get the same result. Can anyone see what is causing them to be hidden?
<Grid Margin="0,0,0,0">
<Grid.RowDefinitions>
<RowDefinition Height="73*"/>
<RowDefinition Height="247*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="259*"/>
<ColumnDefinition Width="258*"/>
</Grid.ColumnDefinitions>
<Button x:Name="btnSave" Content="Save" Grid.Column="1" HorizontalAlignment="Right" Margin="0,10,10,0" Width="60" Height="22" VerticalAlignment="Top"/>
<Button x:Name="btnRevert" Content="Revert" Grid.Column="1" HorizontalAlignment="Right" Margin="0,10,86,0" Width="60" RenderTransformOrigin="-0.047,0.36" Height="22" VerticalAlignment="Top"/>
<Button x:Name="btnAdd" Content="Add" Grid.Column="1" HorizontalAlignment="Right" Margin="0,10,162,0" VerticalAlignment="Top" Width="60"/>
<Button x:Name="btnDelete" Content="Delete" HorizontalAlignment="Right" Margin="0,10,238,0" VerticalAlignment="Top" Width="60" RenderTransformOrigin="-1.521,0.477" Grid.Column="1"/>
<Button x:Name="btnFirst" Content="|<" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="35"/>
<Button x:Name="btnFirst_Copy" Content="|<" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="35"/>
<Button x:Name="btnPrevious" Content="<" HorizontalAlignment="Left" Margin="54,10,0,0" VerticalAlignment="Top" Width="35"/>
<Button x:Name="btnNext" Content=">" HorizontalAlignment="Left" Margin="94,10,0,0" VerticalAlignment="Top" Width="35"/>
<Button x:Name="btnLast" Content=">|" HorizontalAlignment="Left" Margin="134,10,0,0" VerticalAlignment="Top" Width="35" RenderTransformOrigin="4.102,1.005"/>
<StackPanel HorizontalAlignment="Left" Height="28" Grid.Row="1" VerticalAlignment="Top" Width="304">
<Label x:Name="lblCustomerID" Content="Customer ID" Height="28"/>
<Label x:Name="lblFirstName" Content="First Name" Height="28"/>
<Label x:Name="lblLastName" Content="Last Name" Height="28"/>
<Label x:Name="lblCity1" Content="City" Height="28"/>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Left" Height="251" Grid.Row="1" VerticalAlignment="Top" Width="297">
<TextBox x:Name="txtCustomerID" Height="28" TextWrapping="Wrap" Width="Auto" Text="{Binding Path=CustomerID, Mode=OneWay}"/>
<TextBox x:Name="txtLastName" Height="28" TextWrapping="Wrap" Width="Auto" Text="{Binding Path=LastName}"/>
<TextBox x:Name="txtFirstName" Height="28" TextWrapping="Wrap" Width="Auto" Text="{Binding Path=FirstName}"/>
<TextBox x:Name="txtCity" Height="28" TextWrapping="Wrap" Width="Auto" Text="{Binding Path=City}"/>
</StackPanel>
</Grid>
Remove your StackPanel's Height. Let it fill its height automatically. You set it to 28 which makes the other children get cutted off.
<StackPanel HorizontalAlignment="Left" Grid.Row="1" VerticalAlignment="Top" Width="304">
<Label x:Name="lblCustomerID" Content="Customer ID" Height="28"/>
<Label x:Name="lblFirstName" Content="First Name" Height="28"/>
<Label x:Name="lblLastName" Content="Last Name" Height="28"/>
<Label x:Name="lblCity1" Content="City" Height="28"/>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Left" Grid.Row="1" VerticalAlignment="Top" Width="297">
<TextBox x:Name="txtCustomerID" Height="28" TextWrapping="Wrap" Width="Auto" Text="{Binding Path=CustomerID, Mode=OneWay}"/>
<TextBox x:Name="txtLastName" Height="28" TextWrapping="Wrap" Width="Auto" Text="{Binding Path=LastName}"/>
<TextBox x:Name="txtFirstName" Height="28" TextWrapping="Wrap" Width="Auto" Text="{Binding Path=FirstName}"/>
<TextBox x:Name="txtCity" Height="28" TextWrapping="Wrap" Width="Auto" Text="{Binding Path=City}"/>
</StackPanel>

Resources