Allow SmithHtmlEditor for Spell Check - wpf

I'm using the SmithHtmlEditor and it is working fine but we've had the request to add spell checking that is native to WPF <TextBox SpellCheck.IsEnabled=True /> I've simply tried adding that line to the TextBox in the control but I'm not getting the squiggly line and the context menu with suggestions, maybe b/c the WindowsFormsHost. I'm open to changing controls as well.
<Grid>
<TextBox x:Name="CodeEditor"
AcceptsReturn="True"
AcceptsTab="True"
AutoWordSelection="True"
VerticalScrollBarVisibility="Auto"
TextWrapping="Wrap"
SpellCheck.IsEnabled="True"/>
<WindowsFormsHost x:Name="BrowserHost">
<wf:WebBrowser x:Name="VisualEditor" />
</WindowsFormsHost>
</Grid>

This enables spell check to the text editor only. If you go to code mode you will see that spell check is enabled there but only there.
The WebBrowser is WinForms component and you can't add spellcheck in that way.

Related

Having difficulty using Z-Index in WPF

I've followed some examples trying to layer a rectangle over the WebBrowser object:
Here is the MSDN example link. (I got it to work)
Layers issue using Z-Index
Here is the code I'm trying to get to work:
<Grid>
<Canvas Margin="2,4,0,-450" >
<Rectangle Height="452" Canvas.ZIndex="1000" Name="rectangle1" Stroke="Black" Width="524" Opacity=".5" Fill="#8CBABABA" Canvas.Top="-7" Canvas.Left="-3" />
<WebBrowser Name="mapBrowser" Canvas.ZIndex="999" Margin="5,5,5,5" Height="452" Width="516" Canvas.Top="-11" />
</Canvas>
</Grid>
I'm trying to make the WebBrowser appear grayed out by making the rectangle appear over top of it. I'll also disable it.
Can anybody point to what I'm doing wrong?
I solved this issue by creating a .png image which I placed in the same space as the webbrowser. It looks like a grayed-out version of what first appears in the webbrowser. Then I conditionally hid the webbrowser which makes the image visible. This is the only way I've found to make it work using .Net 4.0.

WPF Control remove focus and hover effect (FocusVisualStyle?!)

I am trying to remove the nasty looking effect on controls when hovering or focusing.
This seems not to work:
FocusVisualStyle="{x:Null}"
And this is what I got so far:
<ComboBox Grid.Row="2" HorizontalAlignment="Right" Background="Transparent" BorderBrush="#FFE87E00" FocusVisualStyle="{x:Null}"/>
Thanks in advance!
Look at the control template, you should be able to manipulate what occurs when visual states changes from there.

Label does not change content

I have WPF app with label MainWindow.xaml:
<Label Grid.Row="1" Margin="0,17,0,16" Name="lblLoadDriver" VerticalAlignment="Center" HorizontalAlignment="Left" Height="10" Width="10"></Label>
In MainWindow.xaml.cs there is code, after button click:
lblLoadDriver.Content = ""+DriverInstance.GetType().ToString();
When i debug, I put the mouse over the value of lblLoadDriver browse under "base" section and see content is AS-I-NEED.. i see the text ok, but it didnt change the text on GUI.
Why is this ? Do i need to refresh gui or something ?
thanks.
Perhaps because of Width="10"?
Also Height="10" is a strange idea.

silverlight validation on textbox inside usercontrol

As the title states, I have a usercontrol with a textbox inside. The purpose of the user control is to add a spell check button and character count below the textbox. But for the most part, I'm using it just like a normal textbox:
<controls:SuperTextBox Text="{Binding Accomplishments, Mode=TwoWay, ValidatesOnNotifyDataErrors=True,NotifyOnValidationError=True}"
Height="200" EnableCharacterCounting="True" EnableSpellChecking="True" AcceptsReturn="True"
TextWrapping="Wrap" />
The problem I'm having is that I no longer get the nice red border when validation fails for the field. What do I need to do to reenable that behavior?
What you need to do here, it's to relay the validation of your UserControl back to the textbox.
I did answer a similar question here.

Tools\addin's for formating or cleaning up xaml?

I'm guessing these don't exist since I searched around for these but I'm looking for a few tools:
1) A tool that cleans up my xaml so that the properties of elements are consistent through a file. I think enforcing that consistence would make the xaml easier to read. Maybe there could be a hierarchy of what comes first but if not alphabetical might work.
Example before:
TextBox Name="myTextBox1" Grid.Row="3" Grid.Column="1" Margin="4"
TextBox Grid.Column="1" Margin="4" Name="t2" Grid.Row="3"
Example after:
TextBox Name="myTextBox1" Grid.Row="3" Grid.Column="1" Margin="4"
TextBox Name="t2" Grid.Row="3" Grid.Column="1" Margin="4"
(note < /> has been remove from the above since control seem to have issues parsing whe the after section was added)
2) Along the same lines as above, to increase readability, a tool to align properties, so from the above code example similar props would start in the same place.
<TextBox Name="myTextBox1" Grid.Row="3" Grid.Column="1" Margin="4"/>
<TextBox Name="t2" Grid.Row="3" Grid.Column="1" Margin="4"/>
I know VS has default settings for XAML documents so props can be on one line or separate lines so maybe if there was a tool as described in (1) this would not be needed...but it would still be nice if you like your props all on one line.
3) A tool that adds X to the any of the Grid.Row values and Y to any of the Grid.Column values in the selected text. Every time I add a new row\column I have to go manually fix these. From my understanding Expression Blend can help with this but seem excessive to open Blend just to increment some numbers (and just don't grok Blend). Maybe vs2010 with the designer will help but right now I'm on VS08 and Silverlight.
Any one know of any tools to help with this?
Anyone planning to write something like this...I'm looking at you JetBrains and\or DevExpress.
Thanks.
Try out Kaxaml. It has a couple auto-formatting tools like this.

Resources