Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
When I click the diagnosisButton, there is a button(GenBtn) in the border
GenBtn.omniButtonLabel.Content = "General Information"
When I leave(mouseleave) the border and apply animation(minimize the border slowly slowly),content of GenBtn is lost alphabets bise.
for example:General Informatio,General Informati, General Informat,General Informa,General Inform,General Infor,General Info,General Inf,General In,General I,General and so on..
But I would like to show the content like tihs

General
Information
and then lost.





XML
<Border Name="LeftPanel" DockPanel.Dock="Left" MinWidth="24" VerticalAlignment="Stretch"
                    Background="{DynamicResource MyBlueBackgroundGradientBrush}"
                    BorderBrush="{DynamicResource MyBlueBackgroundGradientBrush}" BorderThickness="1,1,1,1" CornerRadius="4"
                    MouseEnter="LeftPanelMouseEnter" MouseLeave="LeftPanelMouseLeave">
                                <Grid Name="LeftPanelGrid" Width="Auto" Height="Auto">
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height=".060*"/>
                                        <RowDefinition Height=".060*"/>
                                        <RowDefinition Height=".600*"/>
                                        <RowDefinition Height=".165*"/>
                                        <RowDefinition Height=".08*"/>
                                    </Grid.RowDefinitions>
                                    <!--  LEFT PANEL HEADER ( APPLICATION & SELECTED BUTTON )  -->

<Border Name="borderSelectedButton" VerticalAlignment="Stretch" Grid.Row="1"
                            Background="{DynamicResource MyBorderBlueGradientBrush}"
                            BorderBrush="{DynamicResource MyBlueBorderSolidBrush}"
                            BorderThickness="0.5,0.5,0.5,0.5" Margin="1,3,1,0">
                                        <DockPanel x:Name="selectedButton" Width="Auto" Height="20" >
                                            <TextBlock Name="selectedButtonText" VerticalAlignment="Center" Margin="0,0,0,0"
                                       FontSize="11" Foreground="DarkBlue"
                                       Text="" TextWrapping="NoWrap" FontFamily="Tahoma"/>
                        </DockPanel>
                                    </Border>
                                   <!-- MAIN BUTTONS  -->
                                    <Grid x:Name="gridMainButtons" VerticalAlignment="Stretch" Grid.Row="3" Margin="0,1,0,1"
                                Background="{DynamicResource MyBlueBackgroundGradientBrush}">
                                        <Grid.RowDefinitions>
                                            <RowDefinition/>
                                            <RowDefinition/>
                                            <RowDefinition/>
                                        </Grid.RowDefinitions>
                                        <Button Name="diagnosisButton" Grid.Row="0" Style="{DynamicResource MyBottomLeftButtonStyle}"
                                Height="auto" Background="White" Margin="0,0,0,0"
                                BorderBrush="{DynamicResource MyBlueSolidBrush2}" BorderThickness="0,0.2,0,0.2"
                                HorizontalContentAlignment="Left" Padding="3,1,1,1" Click="Diagnosis_Click">
 <StackPanel Width="Auto" Height="auto" Orientation="Horizontal">
                                                <TextBlock HorizontalAlignment="Left" Margin="27,7,0,0" VerticalAlignment="Center"
                                           Foreground="DarkBlue" FontFamily="Tahoma"
                                           TextWrapping="Wrap" FontSize="12">
                                                    <Underline>D</Underline>iagnosis
                                                </TextBlock>
                            </StackPanel>
                                        </Button>
                                        <Button Name="firmwareButton" Grid.Row="1" Style="{DynamicResource MyBottomLeftButtonStyle}"
                                Height="auto" Background="White" Margin="0,0,0,0"
                                BorderBrush="{DynamicResource MyBlueSolidBrush2}" BorderThickness="0,0.2,0,0.2"
                                HorizontalContentAlignment="Left" Padding="3,1,1,1" Width="Auto"
                                Click="firmwareButtonClick">
                                            <StackPanel Width="Auto" Height="auto" Orientation="Horizontal">
                                                <TextBlock HorizontalAlignment="Left" Margin="27,7,0,0" VerticalAlignment="Center"
                                           Foreground="DarkBlue" FontFamily="Tahoma"
                                           TextWrapping="Wrap" FontSize="12">
                                                    <Underline>F</Underline>irmware
                                                </TextBlock>
                            </StackPanel>
 </Button>
                                        <Button Name="readerSettingButton" Grid.Row="2" Style="{DynamicResource MyBottomLeftButtonStyle}"
                                Height="auto" Background="White" Margin="0,0,0,0"
                                BorderBrush="{DynamicResource MyBlueSolidBrush2}" BorderThickness="0,0.2,0,0.2"
                                HorizontalContentAlignment="Left" Padding="3,1,1,1" Width="Auto"
                                Click="readerSettingButtonClick">
                                            <StackPanel Width="Auto" Height="auto" Orientation="Horizontal">
                                                <TextBlock HorizontalAlignment="Left" Margin="27,7,0,0" VerticalAlignment="Center"
                                           Foreground="DarkBlue" FontFamily="Tahoma"
                                           TextWrapping="Wrap" FontSize="12">
                                                    Reader <Underline>S</Underline>ettings
                                                </TextBlock>
                            </StackPanel>
                                        </Button>
</Border>



 private void Diagnosis_Click(object sender, RoutedEventArgs e)
        {
            diagnosis();
        }
 public void diagnosis()
        {

            selectedButtonText.Text = " Diagnosis";

            relatedControlStackPanel.Children.Clear();
            readerButton GenBtn = new readerButton();
            GenBtn.omniButtonLabel.Content = "General Information";
}

 private void LeftPanelMouseLeave(object sender, MouseEventArgs e)
        {

                LeftPanel.Width = LeftPanel.MinWidth;


                this.RegisterName(LeftPanel.Name, LeftPanel);
                DoubleAnimation dbani = new DoubleAnimation();
                dbani.From = LeftPanelMaxWidth;
                dbani.To = 24;
                dbani.Duration = new Duration(TimeSpan.FromSeconds(.7));
                Storyboard.SetTargetName(dbani, LeftPanel.Name);
                Storyboard.SetTargetProperty(dbani, new PropertyPath(Border.WidthProperty));
                Storyboard myWidthAnimatedButtonStoryboard = new Storyboard();
                myWidthAnimatedButtonStoryboard.Children.Add(dbani);
                myWidthAnimatedButtonStoryboard.Begin(LeftPanel);
                mySidebarControl.Visibility = Visibility.Visible;
                selectedButton.Margin = new Thickness(24, 0, 0, 0);
                diagnosisButton.Margin = new Thickness(24, 0, 0, 0);
                firmwareButton.Margin = new Thickness(24, 0, 0, 0);
                readerSettingButton.Margin = new Thickness(24, 0, 0, 0);
                logoPanel.Margin = new Thickness(24, 0, 0, 0);
                /////////////



        }
 private void Diagnosis_Click(object sender, RoutedEventArgs e)
        {
            diagnosis();
        }
 public void diagnosis()
        {

            selectedButtonText.Text = " Diagnosis";

            relatedControlStackPanel.Children.Clear();
            readerButton GenBtn = new readerButton();
            GenBtn.omniButtonLabel.Content = "General Information";
}

 private void LeftPanelMouseLeave(object sender, MouseEventArgs e)
        {

                LeftPanel.Width = LeftPanel.MinWidth;


                this.RegisterName(LeftPanel.Name, LeftPanel);
                DoubleAnimation dbani = new DoubleAnimation();
                dbani.From = LeftPanelMaxWidth;
                dbani.To = 24;
                dbani.Duration = new Duration(TimeSpan.FromSeconds(.7));
                Storyboard.SetTargetName(dbani, LeftPanel.Name);
                Storyboard.SetTargetProperty(dbani, new PropertyPath(Border.WidthProperty));
                Storyboard myWidthAnimatedButtonStoryboard = new Storyboard();
                myWidthAnimatedButtonStoryboard.Children.Add(dbani);
                myWidthAnimatedButtonStoryboard.Begin(LeftPanel);
                mySidebarControl.Visibility = Visibility.Visible;
                selectedButton.Margin = new Thickness(24, 0, 0, 0);
                diagnosisButton.Margin = new Thickness(24, 0, 0, 0);
                firmwareButton.Margin = new Thickness(24, 0, 0, 0);
                readerSettingButton.Margin = new Thickness(24, 0, 0, 0);
                logoPanel.Margin = new Thickness(24, 0, 0, 0);
                /////////////



        }
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900