I dont want to see dotted lines in Expander Header edges












0















1- Create wpf application.



2- Add three WPF Windows to the project as Window1, Window2 and Window3



3- Copy and paste following xaml codes into MainWindow.



<Grid>
<Expander VerticalAlignment="Bottom" HorizontalAlignment="Left" ExpandDirection="Up" Background="Gold" >
<Expander.Header>
<TextBlock Text="Menu"/>
</Expander.Header>
<StackPanel Width="180">
<Button x:Name="Button1" Height="25" Content="Button1"/>
<Button x:Name="Button2" Height="25" Content="Button2"/>
<Button x:Name="Button3" Height="25" Content="Button3"/>
</StackPanel>
</Expander>
</Grid>
</Window>


4- Copy and paste following vb.net codes into MainWindow code behind.



Class MainWindow 
Private Sub MainWindow_KeyDown(sender As System.Object, e As System.Windows.Input.KeyEventArgs) Handles MyBase.KeyDown
If e.Key = Key.F1 Then
Dim myWindow1 As New Window1()
myWindow1.Show()
End If

If e.Key = Key.F2 Then
Dim myWindow2 As New Window2()
myWindow2.Show()
End If

If e.Key = Key.F3 Then
Dim myWindow3 As New Window3()
myWindow3.Show()
End If
End Sub
End Class


C# codes are here



    public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}

private void Window_KeyDown(object sender, KeyEventArgs e)
{
if ((e.Key == Key.F1))
{
Window1 myWindow1 = new Window1();
myWindow1.Show();
}

if ((e.Key == Key.F2))
{
Window2 myWindow2 = new Window2();
myWindow2.Show();
}

if ((e.Key == Key.F3))
{
Window3 myWindow3 = new Window3();
myWindow3.Show();
}

}
}


5- Run this project, then expand that Expander, then press F2, then close Window2.



My question:



I dont want to see dotted lines in Expander Header edges as you can see here: https://prnt.sc/m2oi2n



Note: I have tried following codes but they are not working.



IsTabStop="False" Focusable="False" FocusVisualStyle="{x:Null}"









share|improve this question

























  • A Handles clause in a WPF App?

    – Mary
    Jan 3 at 22:53











  • Is this wrong? Private Sub MainWindow_KeyDown(sender As System.Object, e As System.Windows.Input.KeyEventArgs) Handles MyBase.KeyDown

    – Dr. Code
    Jan 4 at 13:49











  • The WPF default code looks like private void Window_KeyDown(sender Object, e KeyEventArgs) and in the XAML KeyDown="Window_KeyDown" If yours works I guess it is not wrong.

    – Mary
    Jan 4 at 18:01













  • The C# code above is converted from vb.net. I am vb.net expert, and I have no idea about C#.

    – Dr. Code
    Jan 4 at 18:19













  • In vb.net Private Sub Window_KeyDown(sender As Object, e As KeyEventArgs) in XAML KeyDown="Window_KeyDown"

    – Mary
    Jan 4 at 18:25


















0















1- Create wpf application.



2- Add three WPF Windows to the project as Window1, Window2 and Window3



3- Copy and paste following xaml codes into MainWindow.



<Grid>
<Expander VerticalAlignment="Bottom" HorizontalAlignment="Left" ExpandDirection="Up" Background="Gold" >
<Expander.Header>
<TextBlock Text="Menu"/>
</Expander.Header>
<StackPanel Width="180">
<Button x:Name="Button1" Height="25" Content="Button1"/>
<Button x:Name="Button2" Height="25" Content="Button2"/>
<Button x:Name="Button3" Height="25" Content="Button3"/>
</StackPanel>
</Expander>
</Grid>
</Window>


4- Copy and paste following vb.net codes into MainWindow code behind.



Class MainWindow 
Private Sub MainWindow_KeyDown(sender As System.Object, e As System.Windows.Input.KeyEventArgs) Handles MyBase.KeyDown
If e.Key = Key.F1 Then
Dim myWindow1 As New Window1()
myWindow1.Show()
End If

If e.Key = Key.F2 Then
Dim myWindow2 As New Window2()
myWindow2.Show()
End If

If e.Key = Key.F3 Then
Dim myWindow3 As New Window3()
myWindow3.Show()
End If
End Sub
End Class


C# codes are here



    public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}

private void Window_KeyDown(object sender, KeyEventArgs e)
{
if ((e.Key == Key.F1))
{
Window1 myWindow1 = new Window1();
myWindow1.Show();
}

if ((e.Key == Key.F2))
{
Window2 myWindow2 = new Window2();
myWindow2.Show();
}

if ((e.Key == Key.F3))
{
Window3 myWindow3 = new Window3();
myWindow3.Show();
}

}
}


5- Run this project, then expand that Expander, then press F2, then close Window2.



My question:



I dont want to see dotted lines in Expander Header edges as you can see here: https://prnt.sc/m2oi2n



Note: I have tried following codes but they are not working.



IsTabStop="False" Focusable="False" FocusVisualStyle="{x:Null}"









share|improve this question

























  • A Handles clause in a WPF App?

    – Mary
    Jan 3 at 22:53











  • Is this wrong? Private Sub MainWindow_KeyDown(sender As System.Object, e As System.Windows.Input.KeyEventArgs) Handles MyBase.KeyDown

    – Dr. Code
    Jan 4 at 13:49











  • The WPF default code looks like private void Window_KeyDown(sender Object, e KeyEventArgs) and in the XAML KeyDown="Window_KeyDown" If yours works I guess it is not wrong.

    – Mary
    Jan 4 at 18:01













  • The C# code above is converted from vb.net. I am vb.net expert, and I have no idea about C#.

    – Dr. Code
    Jan 4 at 18:19













  • In vb.net Private Sub Window_KeyDown(sender As Object, e As KeyEventArgs) in XAML KeyDown="Window_KeyDown"

    – Mary
    Jan 4 at 18:25
















0












0








0








1- Create wpf application.



2- Add three WPF Windows to the project as Window1, Window2 and Window3



3- Copy and paste following xaml codes into MainWindow.



<Grid>
<Expander VerticalAlignment="Bottom" HorizontalAlignment="Left" ExpandDirection="Up" Background="Gold" >
<Expander.Header>
<TextBlock Text="Menu"/>
</Expander.Header>
<StackPanel Width="180">
<Button x:Name="Button1" Height="25" Content="Button1"/>
<Button x:Name="Button2" Height="25" Content="Button2"/>
<Button x:Name="Button3" Height="25" Content="Button3"/>
</StackPanel>
</Expander>
</Grid>
</Window>


4- Copy and paste following vb.net codes into MainWindow code behind.



Class MainWindow 
Private Sub MainWindow_KeyDown(sender As System.Object, e As System.Windows.Input.KeyEventArgs) Handles MyBase.KeyDown
If e.Key = Key.F1 Then
Dim myWindow1 As New Window1()
myWindow1.Show()
End If

If e.Key = Key.F2 Then
Dim myWindow2 As New Window2()
myWindow2.Show()
End If

If e.Key = Key.F3 Then
Dim myWindow3 As New Window3()
myWindow3.Show()
End If
End Sub
End Class


C# codes are here



    public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}

private void Window_KeyDown(object sender, KeyEventArgs e)
{
if ((e.Key == Key.F1))
{
Window1 myWindow1 = new Window1();
myWindow1.Show();
}

if ((e.Key == Key.F2))
{
Window2 myWindow2 = new Window2();
myWindow2.Show();
}

if ((e.Key == Key.F3))
{
Window3 myWindow3 = new Window3();
myWindow3.Show();
}

}
}


5- Run this project, then expand that Expander, then press F2, then close Window2.



My question:



I dont want to see dotted lines in Expander Header edges as you can see here: https://prnt.sc/m2oi2n



Note: I have tried following codes but they are not working.



IsTabStop="False" Focusable="False" FocusVisualStyle="{x:Null}"









share|improve this question
















1- Create wpf application.



2- Add three WPF Windows to the project as Window1, Window2 and Window3



3- Copy and paste following xaml codes into MainWindow.



<Grid>
<Expander VerticalAlignment="Bottom" HorizontalAlignment="Left" ExpandDirection="Up" Background="Gold" >
<Expander.Header>
<TextBlock Text="Menu"/>
</Expander.Header>
<StackPanel Width="180">
<Button x:Name="Button1" Height="25" Content="Button1"/>
<Button x:Name="Button2" Height="25" Content="Button2"/>
<Button x:Name="Button3" Height="25" Content="Button3"/>
</StackPanel>
</Expander>
</Grid>
</Window>


4- Copy and paste following vb.net codes into MainWindow code behind.



Class MainWindow 
Private Sub MainWindow_KeyDown(sender As System.Object, e As System.Windows.Input.KeyEventArgs) Handles MyBase.KeyDown
If e.Key = Key.F1 Then
Dim myWindow1 As New Window1()
myWindow1.Show()
End If

If e.Key = Key.F2 Then
Dim myWindow2 As New Window2()
myWindow2.Show()
End If

If e.Key = Key.F3 Then
Dim myWindow3 As New Window3()
myWindow3.Show()
End If
End Sub
End Class


C# codes are here



    public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}

private void Window_KeyDown(object sender, KeyEventArgs e)
{
if ((e.Key == Key.F1))
{
Window1 myWindow1 = new Window1();
myWindow1.Show();
}

if ((e.Key == Key.F2))
{
Window2 myWindow2 = new Window2();
myWindow2.Show();
}

if ((e.Key == Key.F3))
{
Window3 myWindow3 = new Window3();
myWindow3.Show();
}

}
}


5- Run this project, then expand that Expander, then press F2, then close Window2.



My question:



I dont want to see dotted lines in Expander Header edges as you can see here: https://prnt.sc/m2oi2n



Note: I have tried following codes but they are not working.



IsTabStop="False" Focusable="False" FocusVisualStyle="{x:Null}"






c# wpf vb.net xaml






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 3 at 19:30







Dr. Code

















asked Jan 3 at 18:31









Dr. CodeDr. Code

398




398













  • A Handles clause in a WPF App?

    – Mary
    Jan 3 at 22:53











  • Is this wrong? Private Sub MainWindow_KeyDown(sender As System.Object, e As System.Windows.Input.KeyEventArgs) Handles MyBase.KeyDown

    – Dr. Code
    Jan 4 at 13:49











  • The WPF default code looks like private void Window_KeyDown(sender Object, e KeyEventArgs) and in the XAML KeyDown="Window_KeyDown" If yours works I guess it is not wrong.

    – Mary
    Jan 4 at 18:01













  • The C# code above is converted from vb.net. I am vb.net expert, and I have no idea about C#.

    – Dr. Code
    Jan 4 at 18:19













  • In vb.net Private Sub Window_KeyDown(sender As Object, e As KeyEventArgs) in XAML KeyDown="Window_KeyDown"

    – Mary
    Jan 4 at 18:25





















  • A Handles clause in a WPF App?

    – Mary
    Jan 3 at 22:53











  • Is this wrong? Private Sub MainWindow_KeyDown(sender As System.Object, e As System.Windows.Input.KeyEventArgs) Handles MyBase.KeyDown

    – Dr. Code
    Jan 4 at 13:49











  • The WPF default code looks like private void Window_KeyDown(sender Object, e KeyEventArgs) and in the XAML KeyDown="Window_KeyDown" If yours works I guess it is not wrong.

    – Mary
    Jan 4 at 18:01













  • The C# code above is converted from vb.net. I am vb.net expert, and I have no idea about C#.

    – Dr. Code
    Jan 4 at 18:19













  • In vb.net Private Sub Window_KeyDown(sender As Object, e As KeyEventArgs) in XAML KeyDown="Window_KeyDown"

    – Mary
    Jan 4 at 18:25



















A Handles clause in a WPF App?

– Mary
Jan 3 at 22:53





A Handles clause in a WPF App?

– Mary
Jan 3 at 22:53













Is this wrong? Private Sub MainWindow_KeyDown(sender As System.Object, e As System.Windows.Input.KeyEventArgs) Handles MyBase.KeyDown

– Dr. Code
Jan 4 at 13:49





Is this wrong? Private Sub MainWindow_KeyDown(sender As System.Object, e As System.Windows.Input.KeyEventArgs) Handles MyBase.KeyDown

– Dr. Code
Jan 4 at 13:49













The WPF default code looks like private void Window_KeyDown(sender Object, e KeyEventArgs) and in the XAML KeyDown="Window_KeyDown" If yours works I guess it is not wrong.

– Mary
Jan 4 at 18:01







The WPF default code looks like private void Window_KeyDown(sender Object, e KeyEventArgs) and in the XAML KeyDown="Window_KeyDown" If yours works I guess it is not wrong.

– Mary
Jan 4 at 18:01















The C# code above is converted from vb.net. I am vb.net expert, and I have no idea about C#.

– Dr. Code
Jan 4 at 18:19







The C# code above is converted from vb.net. I am vb.net expert, and I have no idea about C#.

– Dr. Code
Jan 4 at 18:19















In vb.net Private Sub Window_KeyDown(sender As Object, e As KeyEventArgs) in XAML KeyDown="Window_KeyDown"

– Mary
Jan 4 at 18:25







In vb.net Private Sub Window_KeyDown(sender As Object, e As KeyEventArgs) in XAML KeyDown="Window_KeyDown"

– Mary
Jan 4 at 18:25














1 Answer
1






active

oldest

votes


















0














The dotted rectangle you see is defined by the FocusVisualStyle on ToggleButton in expander default control template. You can clone and edit the control template by right clicking on the control (Visual Studio 2017) and selecting Edit Template > Edit Copy. Then alter the ExpanderHeaderFocusVisual style.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54027898%2fi-dont-want-to-see-dotted-lines-in-expander-header-edges%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The dotted rectangle you see is defined by the FocusVisualStyle on ToggleButton in expander default control template. You can clone and edit the control template by right clicking on the control (Visual Studio 2017) and selecting Edit Template > Edit Copy. Then alter the ExpanderHeaderFocusVisual style.






    share|improve this answer




























      0














      The dotted rectangle you see is defined by the FocusVisualStyle on ToggleButton in expander default control template. You can clone and edit the control template by right clicking on the control (Visual Studio 2017) and selecting Edit Template > Edit Copy. Then alter the ExpanderHeaderFocusVisual style.






      share|improve this answer


























        0












        0








        0







        The dotted rectangle you see is defined by the FocusVisualStyle on ToggleButton in expander default control template. You can clone and edit the control template by right clicking on the control (Visual Studio 2017) and selecting Edit Template > Edit Copy. Then alter the ExpanderHeaderFocusVisual style.






        share|improve this answer













        The dotted rectangle you see is defined by the FocusVisualStyle on ToggleButton in expander default control template. You can clone and edit the control template by right clicking on the control (Visual Studio 2017) and selecting Edit Template > Edit Copy. Then alter the ExpanderHeaderFocusVisual style.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 3 at 20:53









        Congenital OptimistCongenital Optimist

        22028




        22028
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54027898%2fi-dont-want-to-see-dotted-lines-in-expander-header-edges%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas