C# WPF - Problem with Material Design Textbox












1















I'm new to programming and started to make an application for school. For that I use C# WPF and for a good-looking Application i installed Material Design.



First i started the Demo of Material Design, where you can see what things you can use etc. with the good to copy. So after a quick view I found a nice TextBox with a border and a Checkbox on top of it. The code to copy was this



<StackPanel>
<CheckBox
x:Name="MaterialDesignOutlinedTextFieldTextBoxEnabledComboBox"
IsChecked="True"
Margin="32,0,0,8">
Enabled
</CheckBox>
<TextBox
Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}"
Margin="32,0,0,0"
VerticalAlignment="Top"
Height="100"
AcceptsReturn="True"
TextWrapping="Wrap"
VerticalScrollBarVisibility="Auto"
materialDesign:HintAssist.Hint="This is a text area"
IsEnabled="{Binding Path=IsChecked,
ElementName=MaterialDesignOutlinedTextFieldTextBoxEnabledComboBox}" />
</StackPanel>


Because I just needed the Textbox, I deleted the Code of the CheckBox and implemented the rest inside my application. So the code now is like this:



<TextBox
Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}"
Margin="32,0,0,0"
VerticalAlignment="Top"
Height="100"
AcceptsReturn="True"
TextWrapping="Wrap"
VerticalScrollBarVisibility="Auto"
materialDesign:HintAssist.Hint="This is a text area"
/>


The problem now is, that I can't edit the textbox. I guess the TextBox is linked to the CheckBox and because I deleted it, somehow i can't write in it anymore.
It all works fine with a standard textbox, but with the copied code i cant do anything, just see the TextBox with its rounded border.



So can anyone help me, how I can implement the textbox with this border and so on AND while I can edit it? I don't know any solution for that right now, so I would appreciate it, if somebody could help me there.



Thanks for your help.










share|improve this question

























  • Try adding IsEnabled="True" to your textbox? Maybe it's disabled in the styling.

    – SwiftingDuster
    Nov 25 '18 at 14:57













  • Already tried that....didn't help at all. :(

    – Coding_Noob
    Nov 25 '18 at 14:59











  • Open blend and edit current style may be there is something in style which is preventing you to edit textbox however i am assuming you removed that IsEnabled binding with checkbox

    – Shubham Sahu
    Nov 25 '18 at 15:18











  • yea thats right, I removed the IsEnabled binding with the checkbox, because I dont need a CheckBox in my application. All I need is that TextBox with the border and so on while I can edit it. Actually I have the TextBox with the border but I cant write in my TextBox. I want that to fix.

    – Coding_Noob
    Nov 25 '18 at 18:46
















1















I'm new to programming and started to make an application for school. For that I use C# WPF and for a good-looking Application i installed Material Design.



First i started the Demo of Material Design, where you can see what things you can use etc. with the good to copy. So after a quick view I found a nice TextBox with a border and a Checkbox on top of it. The code to copy was this



<StackPanel>
<CheckBox
x:Name="MaterialDesignOutlinedTextFieldTextBoxEnabledComboBox"
IsChecked="True"
Margin="32,0,0,8">
Enabled
</CheckBox>
<TextBox
Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}"
Margin="32,0,0,0"
VerticalAlignment="Top"
Height="100"
AcceptsReturn="True"
TextWrapping="Wrap"
VerticalScrollBarVisibility="Auto"
materialDesign:HintAssist.Hint="This is a text area"
IsEnabled="{Binding Path=IsChecked,
ElementName=MaterialDesignOutlinedTextFieldTextBoxEnabledComboBox}" />
</StackPanel>


Because I just needed the Textbox, I deleted the Code of the CheckBox and implemented the rest inside my application. So the code now is like this:



<TextBox
Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}"
Margin="32,0,0,0"
VerticalAlignment="Top"
Height="100"
AcceptsReturn="True"
TextWrapping="Wrap"
VerticalScrollBarVisibility="Auto"
materialDesign:HintAssist.Hint="This is a text area"
/>


The problem now is, that I can't edit the textbox. I guess the TextBox is linked to the CheckBox and because I deleted it, somehow i can't write in it anymore.
It all works fine with a standard textbox, but with the copied code i cant do anything, just see the TextBox with its rounded border.



So can anyone help me, how I can implement the textbox with this border and so on AND while I can edit it? I don't know any solution for that right now, so I would appreciate it, if somebody could help me there.



Thanks for your help.










share|improve this question

























  • Try adding IsEnabled="True" to your textbox? Maybe it's disabled in the styling.

    – SwiftingDuster
    Nov 25 '18 at 14:57













  • Already tried that....didn't help at all. :(

    – Coding_Noob
    Nov 25 '18 at 14:59











  • Open blend and edit current style may be there is something in style which is preventing you to edit textbox however i am assuming you removed that IsEnabled binding with checkbox

    – Shubham Sahu
    Nov 25 '18 at 15:18











  • yea thats right, I removed the IsEnabled binding with the checkbox, because I dont need a CheckBox in my application. All I need is that TextBox with the border and so on while I can edit it. Actually I have the TextBox with the border but I cant write in my TextBox. I want that to fix.

    – Coding_Noob
    Nov 25 '18 at 18:46














1












1








1








I'm new to programming and started to make an application for school. For that I use C# WPF and for a good-looking Application i installed Material Design.



First i started the Demo of Material Design, where you can see what things you can use etc. with the good to copy. So after a quick view I found a nice TextBox with a border and a Checkbox on top of it. The code to copy was this



<StackPanel>
<CheckBox
x:Name="MaterialDesignOutlinedTextFieldTextBoxEnabledComboBox"
IsChecked="True"
Margin="32,0,0,8">
Enabled
</CheckBox>
<TextBox
Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}"
Margin="32,0,0,0"
VerticalAlignment="Top"
Height="100"
AcceptsReturn="True"
TextWrapping="Wrap"
VerticalScrollBarVisibility="Auto"
materialDesign:HintAssist.Hint="This is a text area"
IsEnabled="{Binding Path=IsChecked,
ElementName=MaterialDesignOutlinedTextFieldTextBoxEnabledComboBox}" />
</StackPanel>


Because I just needed the Textbox, I deleted the Code of the CheckBox and implemented the rest inside my application. So the code now is like this:



<TextBox
Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}"
Margin="32,0,0,0"
VerticalAlignment="Top"
Height="100"
AcceptsReturn="True"
TextWrapping="Wrap"
VerticalScrollBarVisibility="Auto"
materialDesign:HintAssist.Hint="This is a text area"
/>


The problem now is, that I can't edit the textbox. I guess the TextBox is linked to the CheckBox and because I deleted it, somehow i can't write in it anymore.
It all works fine with a standard textbox, but with the copied code i cant do anything, just see the TextBox with its rounded border.



So can anyone help me, how I can implement the textbox with this border and so on AND while I can edit it? I don't know any solution for that right now, so I would appreciate it, if somebody could help me there.



Thanks for your help.










share|improve this question
















I'm new to programming and started to make an application for school. For that I use C# WPF and for a good-looking Application i installed Material Design.



First i started the Demo of Material Design, where you can see what things you can use etc. with the good to copy. So after a quick view I found a nice TextBox with a border and a Checkbox on top of it. The code to copy was this



<StackPanel>
<CheckBox
x:Name="MaterialDesignOutlinedTextFieldTextBoxEnabledComboBox"
IsChecked="True"
Margin="32,0,0,8">
Enabled
</CheckBox>
<TextBox
Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}"
Margin="32,0,0,0"
VerticalAlignment="Top"
Height="100"
AcceptsReturn="True"
TextWrapping="Wrap"
VerticalScrollBarVisibility="Auto"
materialDesign:HintAssist.Hint="This is a text area"
IsEnabled="{Binding Path=IsChecked,
ElementName=MaterialDesignOutlinedTextFieldTextBoxEnabledComboBox}" />
</StackPanel>


Because I just needed the Textbox, I deleted the Code of the CheckBox and implemented the rest inside my application. So the code now is like this:



<TextBox
Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}"
Margin="32,0,0,0"
VerticalAlignment="Top"
Height="100"
AcceptsReturn="True"
TextWrapping="Wrap"
VerticalScrollBarVisibility="Auto"
materialDesign:HintAssist.Hint="This is a text area"
/>


The problem now is, that I can't edit the textbox. I guess the TextBox is linked to the CheckBox and because I deleted it, somehow i can't write in it anymore.
It all works fine with a standard textbox, but with the copied code i cant do anything, just see the TextBox with its rounded border.



So can anyone help me, how I can implement the textbox with this border and so on AND while I can edit it? I don't know any solution for that right now, so I would appreciate it, if somebody could help me there.



Thanks for your help.







c# wpf material-design






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 16:17









Stephen Kennedy

7,377135068




7,377135068










asked Nov 25 '18 at 14:48









Coding_NoobCoding_Noob

374




374













  • Try adding IsEnabled="True" to your textbox? Maybe it's disabled in the styling.

    – SwiftingDuster
    Nov 25 '18 at 14:57













  • Already tried that....didn't help at all. :(

    – Coding_Noob
    Nov 25 '18 at 14:59











  • Open blend and edit current style may be there is something in style which is preventing you to edit textbox however i am assuming you removed that IsEnabled binding with checkbox

    – Shubham Sahu
    Nov 25 '18 at 15:18











  • yea thats right, I removed the IsEnabled binding with the checkbox, because I dont need a CheckBox in my application. All I need is that TextBox with the border and so on while I can edit it. Actually I have the TextBox with the border but I cant write in my TextBox. I want that to fix.

    – Coding_Noob
    Nov 25 '18 at 18:46



















  • Try adding IsEnabled="True" to your textbox? Maybe it's disabled in the styling.

    – SwiftingDuster
    Nov 25 '18 at 14:57













  • Already tried that....didn't help at all. :(

    – Coding_Noob
    Nov 25 '18 at 14:59











  • Open blend and edit current style may be there is something in style which is preventing you to edit textbox however i am assuming you removed that IsEnabled binding with checkbox

    – Shubham Sahu
    Nov 25 '18 at 15:18











  • yea thats right, I removed the IsEnabled binding with the checkbox, because I dont need a CheckBox in my application. All I need is that TextBox with the border and so on while I can edit it. Actually I have the TextBox with the border but I cant write in my TextBox. I want that to fix.

    – Coding_Noob
    Nov 25 '18 at 18:46

















Try adding IsEnabled="True" to your textbox? Maybe it's disabled in the styling.

– SwiftingDuster
Nov 25 '18 at 14:57







Try adding IsEnabled="True" to your textbox? Maybe it's disabled in the styling.

– SwiftingDuster
Nov 25 '18 at 14:57















Already tried that....didn't help at all. :(

– Coding_Noob
Nov 25 '18 at 14:59





Already tried that....didn't help at all. :(

– Coding_Noob
Nov 25 '18 at 14:59













Open blend and edit current style may be there is something in style which is preventing you to edit textbox however i am assuming you removed that IsEnabled binding with checkbox

– Shubham Sahu
Nov 25 '18 at 15:18





Open blend and edit current style may be there is something in style which is preventing you to edit textbox however i am assuming you removed that IsEnabled binding with checkbox

– Shubham Sahu
Nov 25 '18 at 15:18













yea thats right, I removed the IsEnabled binding with the checkbox, because I dont need a CheckBox in my application. All I need is that TextBox with the border and so on while I can edit it. Actually I have the TextBox with the border but I cant write in my TextBox. I want that to fix.

– Coding_Noob
Nov 25 '18 at 18:46





yea thats right, I removed the IsEnabled binding with the checkbox, because I dont need a CheckBox in my application. All I need is that TextBox with the border and so on while I can edit it. Actually I have the TextBox with the border but I cant write in my TextBox. I want that to fix.

– Coding_Noob
Nov 25 '18 at 18:46












1 Answer
1






active

oldest

votes


















0














Try following their Super Quick Start guide.



Below is a modified version of it that uses a TextBox:




  • Start new WPF project


  • Install MaterialDesignThemes nuget: Install-Package MaterialDesignThemes



  • Edit App.xaml to following:



    <Application ...>
    <Application.Resources>
    <ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
    </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
    </Application.Resources>
    </Application>



  • Edit MainWindow.xaml to following:



    <Window
    xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
    ...>
    <StackPanel>
    <TextBox
    materialDesign:HintAssist.Hint="Hey, that's pretty good!"
    Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" />
    </StackPanel>
    </Window>







share|improve this answer
























  • I did that, but it doesn't work either. As soon as I implement Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" I cant write in the TextBox anymore. Maybe its useful to know, that I define the TextBoxes inside an UserControl...but I defined the Resources and all that stuff like it was told me in the Starting Guide

    – Coding_Noob
    Nov 25 '18 at 17:35













  • Try following the guide as is. Use the MainWindow.xaml. And see it work. After that, put it in a UserControl.

    – Paolo Go
    Nov 25 '18 at 17:40













  • Did exactly that. Edited the App.xaml, the MainWindows.xaml and my Usercontrol.xaml, but I still can't edit it, even when i set the TextBox in the MainWindow. When I set xmlns:materialDesign="materialdesigninxaml.net/winfx/xaml/themes" in my .xaml it told me "The namespace "materialDeasign" is unnecessary" ?

    – Coding_Noob
    Nov 25 '18 at 18:00













  • Did you add MaterialDesignThemes nuget package?

    – Paolo Go
    Nov 25 '18 at 18:11











  • Yea, I just checked it. Installed MaterialDesignThemes and MaterialDesignColor. When I define a normal <Textbox /> it's also in the MaterialDesign Theme and not like the standard TexBox...I really just have a problem when i add the code Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" to my TextBox...as soon as I do that, I can't edit it for whatever reason.

    – Coding_Noob
    Nov 25 '18 at 18:14













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%2f53468679%2fc-sharp-wpf-problem-with-material-design-textbox%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














Try following their Super Quick Start guide.



Below is a modified version of it that uses a TextBox:




  • Start new WPF project


  • Install MaterialDesignThemes nuget: Install-Package MaterialDesignThemes



  • Edit App.xaml to following:



    <Application ...>
    <Application.Resources>
    <ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
    </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
    </Application.Resources>
    </Application>



  • Edit MainWindow.xaml to following:



    <Window
    xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
    ...>
    <StackPanel>
    <TextBox
    materialDesign:HintAssist.Hint="Hey, that's pretty good!"
    Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" />
    </StackPanel>
    </Window>







share|improve this answer
























  • I did that, but it doesn't work either. As soon as I implement Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" I cant write in the TextBox anymore. Maybe its useful to know, that I define the TextBoxes inside an UserControl...but I defined the Resources and all that stuff like it was told me in the Starting Guide

    – Coding_Noob
    Nov 25 '18 at 17:35













  • Try following the guide as is. Use the MainWindow.xaml. And see it work. After that, put it in a UserControl.

    – Paolo Go
    Nov 25 '18 at 17:40













  • Did exactly that. Edited the App.xaml, the MainWindows.xaml and my Usercontrol.xaml, but I still can't edit it, even when i set the TextBox in the MainWindow. When I set xmlns:materialDesign="materialdesigninxaml.net/winfx/xaml/themes" in my .xaml it told me "The namespace "materialDeasign" is unnecessary" ?

    – Coding_Noob
    Nov 25 '18 at 18:00













  • Did you add MaterialDesignThemes nuget package?

    – Paolo Go
    Nov 25 '18 at 18:11











  • Yea, I just checked it. Installed MaterialDesignThemes and MaterialDesignColor. When I define a normal <Textbox /> it's also in the MaterialDesign Theme and not like the standard TexBox...I really just have a problem when i add the code Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" to my TextBox...as soon as I do that, I can't edit it for whatever reason.

    – Coding_Noob
    Nov 25 '18 at 18:14


















0














Try following their Super Quick Start guide.



Below is a modified version of it that uses a TextBox:




  • Start new WPF project


  • Install MaterialDesignThemes nuget: Install-Package MaterialDesignThemes



  • Edit App.xaml to following:



    <Application ...>
    <Application.Resources>
    <ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
    </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
    </Application.Resources>
    </Application>



  • Edit MainWindow.xaml to following:



    <Window
    xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
    ...>
    <StackPanel>
    <TextBox
    materialDesign:HintAssist.Hint="Hey, that's pretty good!"
    Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" />
    </StackPanel>
    </Window>







share|improve this answer
























  • I did that, but it doesn't work either. As soon as I implement Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" I cant write in the TextBox anymore. Maybe its useful to know, that I define the TextBoxes inside an UserControl...but I defined the Resources and all that stuff like it was told me in the Starting Guide

    – Coding_Noob
    Nov 25 '18 at 17:35













  • Try following the guide as is. Use the MainWindow.xaml. And see it work. After that, put it in a UserControl.

    – Paolo Go
    Nov 25 '18 at 17:40













  • Did exactly that. Edited the App.xaml, the MainWindows.xaml and my Usercontrol.xaml, but I still can't edit it, even when i set the TextBox in the MainWindow. When I set xmlns:materialDesign="materialdesigninxaml.net/winfx/xaml/themes" in my .xaml it told me "The namespace "materialDeasign" is unnecessary" ?

    – Coding_Noob
    Nov 25 '18 at 18:00













  • Did you add MaterialDesignThemes nuget package?

    – Paolo Go
    Nov 25 '18 at 18:11











  • Yea, I just checked it. Installed MaterialDesignThemes and MaterialDesignColor. When I define a normal <Textbox /> it's also in the MaterialDesign Theme and not like the standard TexBox...I really just have a problem when i add the code Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" to my TextBox...as soon as I do that, I can't edit it for whatever reason.

    – Coding_Noob
    Nov 25 '18 at 18:14
















0












0








0







Try following their Super Quick Start guide.



Below is a modified version of it that uses a TextBox:




  • Start new WPF project


  • Install MaterialDesignThemes nuget: Install-Package MaterialDesignThemes



  • Edit App.xaml to following:



    <Application ...>
    <Application.Resources>
    <ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
    </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
    </Application.Resources>
    </Application>



  • Edit MainWindow.xaml to following:



    <Window
    xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
    ...>
    <StackPanel>
    <TextBox
    materialDesign:HintAssist.Hint="Hey, that's pretty good!"
    Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" />
    </StackPanel>
    </Window>







share|improve this answer













Try following their Super Quick Start guide.



Below is a modified version of it that uses a TextBox:




  • Start new WPF project


  • Install MaterialDesignThemes nuget: Install-Package MaterialDesignThemes



  • Edit App.xaml to following:



    <Application ...>
    <Application.Resources>
    <ResourceDictionary>
    <ResourceDictionary.MergedDictionaries>
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepPurple.xaml" />
    <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
    </ResourceDictionary.MergedDictionaries>
    </ResourceDictionary>
    </Application.Resources>
    </Application>



  • Edit MainWindow.xaml to following:



    <Window
    xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
    ...>
    <StackPanel>
    <TextBox
    materialDesign:HintAssist.Hint="Hey, that's pretty good!"
    Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" />
    </StackPanel>
    </Window>








share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 25 '18 at 17:03









Paolo GoPaolo Go

1,469622




1,469622













  • I did that, but it doesn't work either. As soon as I implement Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" I cant write in the TextBox anymore. Maybe its useful to know, that I define the TextBoxes inside an UserControl...but I defined the Resources and all that stuff like it was told me in the Starting Guide

    – Coding_Noob
    Nov 25 '18 at 17:35













  • Try following the guide as is. Use the MainWindow.xaml. And see it work. After that, put it in a UserControl.

    – Paolo Go
    Nov 25 '18 at 17:40













  • Did exactly that. Edited the App.xaml, the MainWindows.xaml and my Usercontrol.xaml, but I still can't edit it, even when i set the TextBox in the MainWindow. When I set xmlns:materialDesign="materialdesigninxaml.net/winfx/xaml/themes" in my .xaml it told me "The namespace "materialDeasign" is unnecessary" ?

    – Coding_Noob
    Nov 25 '18 at 18:00













  • Did you add MaterialDesignThemes nuget package?

    – Paolo Go
    Nov 25 '18 at 18:11











  • Yea, I just checked it. Installed MaterialDesignThemes and MaterialDesignColor. When I define a normal <Textbox /> it's also in the MaterialDesign Theme and not like the standard TexBox...I really just have a problem when i add the code Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" to my TextBox...as soon as I do that, I can't edit it for whatever reason.

    – Coding_Noob
    Nov 25 '18 at 18:14





















  • I did that, but it doesn't work either. As soon as I implement Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" I cant write in the TextBox anymore. Maybe its useful to know, that I define the TextBoxes inside an UserControl...but I defined the Resources and all that stuff like it was told me in the Starting Guide

    – Coding_Noob
    Nov 25 '18 at 17:35













  • Try following the guide as is. Use the MainWindow.xaml. And see it work. After that, put it in a UserControl.

    – Paolo Go
    Nov 25 '18 at 17:40













  • Did exactly that. Edited the App.xaml, the MainWindows.xaml and my Usercontrol.xaml, but I still can't edit it, even when i set the TextBox in the MainWindow. When I set xmlns:materialDesign="materialdesigninxaml.net/winfx/xaml/themes" in my .xaml it told me "The namespace "materialDeasign" is unnecessary" ?

    – Coding_Noob
    Nov 25 '18 at 18:00













  • Did you add MaterialDesignThemes nuget package?

    – Paolo Go
    Nov 25 '18 at 18:11











  • Yea, I just checked it. Installed MaterialDesignThemes and MaterialDesignColor. When I define a normal <Textbox /> it's also in the MaterialDesign Theme and not like the standard TexBox...I really just have a problem when i add the code Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" to my TextBox...as soon as I do that, I can't edit it for whatever reason.

    – Coding_Noob
    Nov 25 '18 at 18:14



















I did that, but it doesn't work either. As soon as I implement Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" I cant write in the TextBox anymore. Maybe its useful to know, that I define the TextBoxes inside an UserControl...but I defined the Resources and all that stuff like it was told me in the Starting Guide

– Coding_Noob
Nov 25 '18 at 17:35







I did that, but it doesn't work either. As soon as I implement Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" I cant write in the TextBox anymore. Maybe its useful to know, that I define the TextBoxes inside an UserControl...but I defined the Resources and all that stuff like it was told me in the Starting Guide

– Coding_Noob
Nov 25 '18 at 17:35















Try following the guide as is. Use the MainWindow.xaml. And see it work. After that, put it in a UserControl.

– Paolo Go
Nov 25 '18 at 17:40







Try following the guide as is. Use the MainWindow.xaml. And see it work. After that, put it in a UserControl.

– Paolo Go
Nov 25 '18 at 17:40















Did exactly that. Edited the App.xaml, the MainWindows.xaml and my Usercontrol.xaml, but I still can't edit it, even when i set the TextBox in the MainWindow. When I set xmlns:materialDesign="materialdesigninxaml.net/winfx/xaml/themes" in my .xaml it told me "The namespace "materialDeasign" is unnecessary" ?

– Coding_Noob
Nov 25 '18 at 18:00







Did exactly that. Edited the App.xaml, the MainWindows.xaml and my Usercontrol.xaml, but I still can't edit it, even when i set the TextBox in the MainWindow. When I set xmlns:materialDesign="materialdesigninxaml.net/winfx/xaml/themes" in my .xaml it told me "The namespace "materialDeasign" is unnecessary" ?

– Coding_Noob
Nov 25 '18 at 18:00















Did you add MaterialDesignThemes nuget package?

– Paolo Go
Nov 25 '18 at 18:11





Did you add MaterialDesignThemes nuget package?

– Paolo Go
Nov 25 '18 at 18:11













Yea, I just checked it. Installed MaterialDesignThemes and MaterialDesignColor. When I define a normal <Textbox /> it's also in the MaterialDesign Theme and not like the standard TexBox...I really just have a problem when i add the code Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" to my TextBox...as soon as I do that, I can't edit it for whatever reason.

– Coding_Noob
Nov 25 '18 at 18:14







Yea, I just checked it. Installed MaterialDesignThemes and MaterialDesignColor. When I define a normal <Textbox /> it's also in the MaterialDesign Theme and not like the standard TexBox...I really just have a problem when i add the code Style="{StaticResource MaterialDesignOutlinedTextFieldTextBox}" to my TextBox...as soon as I do that, I can't edit it for whatever reason.

– Coding_Noob
Nov 25 '18 at 18:14






















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%2f53468679%2fc-sharp-wpf-problem-with-material-design-textbox%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

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively