Telerik Forums
UI for WPF Forum
6 answers
1.0K+ views

I am trying to default my FontSize to 8 and FontFamily to Arial, by doing:

richTextBox.FontFamily = New FontFamily("Arial")
richTextBox.FontSize = 10.67

When the richtextbox first loads, the comboxes are correct and the font is correct, however, when I save the html from the htmlformatprovider and load it back into a richtextbox, my font is now set as Verdana & 12. This is the html that was outputted:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled</title><style type="text/css">
p { text-indent: 0pt;padding: 0px 0px 0px 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 12px;margin-left: 0px;text-align: left;font-family: 'Verdana';font-style: Normal;font-weight: normal;font-size: 16px;color: #000000; } 
.defaultDocumentStyle { telerik-style-type: default;telerik-style-name: defaultDocumentStyle;font-family: 'Arial';font-style: Normal;font-weight: normal;font-size: 10.67px;margin-bottom: 0px; } 
.p_DEC438A7 { telerik-style-type: local; } 
.s_DEC438A7 { telerik-style-type: local; } 
</style></head><body><p class="p_DEC438A7"><span class="s_DEC438A7">Try again, do i get to save Arial 8?</span></p></body></html>

If I enter the control, change the font back to Arial and 8, it saves and reload correctly, this is the html that is now saved and works:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled</title><style type="text/css">
p { text-indent: 0pt;padding: 0px 0px 0px 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 12px;margin-left: 0px;text-align: left;font-family: 'Verdana';font-style: Normal;font-weight: normal;font-size: 16px;color: #000000; } 
.defaultDocumentStyle { telerik-style-type: default;telerik-style-name: defaultDocumentStyle;font-family: 'Arial';font-style: Normal;font-weight: normal;font-size: 10.67px;margin-bottom: 0px; } 
.p_DEE65F0 { telerik-style-type: local;margin-top: 0px;margin-right: 0px;margin-bottom: 12px;margin-left: 0px;text-align: left; } 
.s_8905ECE5 { telerik-style-type: local;font-family: 'Arial';font-style: Normal;font-weight: normal;font-size: 10.67px;color: #000000; } 
.s_9FFAD006 { telerik-style-type: local;font-family: 'Verdana';font-style: Normal;font-weight: normal;font-size: 16px;color: #000000; } 
</style></head><body><p class="p_DEE65F0"><span class="s_8905ECE5">Try again, do i get to save Arial 8?</span><span class="s_9FFAD006" /></p></body></html>

Everything used to work correctly before the Q3 SP1 version

How do I set the default font family and size correctly now? I wouldn't expect Verdana 12(16px) to be anywhere in the outputted html code.
Tanya
Telerik team
 answered on 05 May 2016
1 answer
171 views

I have an app that runs on a touchscreen and I am trying to capture the GotTouchCaptureEvent so that I can display the onscreen keyboard when the textbox is touched. It worked fine for a TextBox, but I am converting to RadMaskedTextInput controls to take advantage of the input masking and input validation. The event is fired from the TextBoxes (it works as desired if I change RadTouchTextBox to derive from TextBox), but not from the RadMaskedTextInput controls. The GotFocus and the LostKeyboardFocusEvent both work fine.

Here is the code:

ViewModel:

    public class RadTouchTextBox : RadMaskedTextInput
    {
        /// <summary>
        /// TextBox class with event handlers
        /// </summary>
        public RadTouchTextBox()
        {
                this.GotFocus += TextBox_GotFocus;
                this.GotTouchCapture += TextBox_GotTouchCapture;
                this.LostKeyboardFocus += TextBox_LostKeyboardFocusEvent;
        }

         private static void TextBox_GotFocus(object sender, RoutedEventArgs e)
        {
            (sender as TextBox)?.SelectAll();
        }

        private static void TextBox_GotTouchCapture(object sender, RoutedEventArgs e)
        {
            try
            {
                Process.Start(@"c:\Program Files\Common Files\microsoft shared\ink\tabtip.exe");
            }
            catch
            {
                // if the tabtip display fails for any reason, do nothing.
            }
        }

        private static void TextBox_LostKeyboardFocusEvent(object sender, RoutedEventArgs e)
        {
            Process[] processlist = Process.GetProcesses();

            foreach (Process process in processlist)
            {
                if (process.ProcessName == "TabTip")
                {
                    try
                    {
                        process.Kill();
                    }
                    catch
                    {
                        // if killing the process fails, ignore
                    }
                    break;
                }
            }
        }

 

        public string ServerPath
        {
            get { return GetProperty<string>(); }
            set { SetProperty(value); }
        }

 

xaml:

 

<DockPanel>

.

.

.

         <RadTouchTextBox Width="300" Margin="5" FontSize="24"
                 Value="{Binding ServerPath, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay, ValidatesOnExceptions=True}"
</DockPanel>

 

Any help is appreciated.

 

George

 

George
Top achievements
Rank 1
 answered on 05 May 2016
3 answers
115 views

Hi, I have a gridview that can have configurable colums. Some of them use the default template, but others not. I have a problem with the ones that need to show icons.

 

Here is a sample of a datatemplate of a GridViewCell:

 

<DataTemplate x:Key="IconFlagsCellTemplate">
    <StackPanel Name="IconFlagsCellTemplate" Orientation="Horizontal" DataContext="{Binding Blockings, Converter={StaticResource IconFlagsConverter}}">
        <Image Source="{StaticResource BlockingTechnicalOffice16x16}" Visibility="{Binding TechnicalOffice, Converter={StaticResource Boolean2VisibilityConverter}}"/>
 
 
    </StackPanel>
</DataTemplate>

 

This works ok. The problem comes, for example, when I try to assing a tooltip:

<DataTemplate x:Key="IconFlagsCellTemplate">
    <StackPanel Name="IconFlagsCellTemplate" Orientation="Horizontal" DataContext="{Binding Blockings, Converter={StaticResource IconFlagsConverter}}">
 
        <Image Source="{StaticResource BlockingTechnicalOffice16x16}" ToolTip="{lex:Loc BudgetBlockingTooltip_TECHNICAL_OFFICE}"
            Visibility="{Binding TechnicalOffice, Converter={StaticResource Boolean2VisibilityConverter}}"/>
 
    </StackPanel>
</DataTemplate>

I receive the next error when I scroll horizontally and the cell is going out of scope, the moment that I think the control will recycle the cell:

System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.FrameworkElement', AncestorLevel='1''. BindingExpression:Path=Parent; DataItem=null; target element is 'StackPanel' (Name='IconFlagsCellTemplate'); target property is 'Parent' (type 'DependencyObject')

 

Also this produces that the horizontal scroll pauses a little bit when giving those errors, causing a notieceable visual delay.

But there is more. I need the image to be wrapped into a button, as I need to add a contextual menu to the button and some triggers, but this also produces the avobe error, no matter if there is tooltip or not. Fortunately, if instead of the button I put a ContentControl, but not tooltip, there is no problem as well.

 

I need, though, both tooltip and custom menu. And also there is need to keep into account that there will not be only an icon. There could be any number of icons, that will be shown or not depending on some ViewModel condition, as you can see with the bindings.

 

Hope anybody could help me by providing a working solution, as the client is complaining about the scrolling issue. Meanwhile I'll try to test other ways of doing things.

 

Thanks in advance.

 

David.

 

 

Yoan
Telerik team
 answered on 05 May 2016
1 answer
484 views

I am using MVVM to display a busy indicator. If I tell the indicator to show in an async on click event in code behind it shows up. However when I have my view model set the exact same property to true from a command it never shows up.

 

<telerik:RadBusyIndicator Name="LoggingInBusyIndicator" BusyContent="Logging In" IsBusy="{Binding ShowLoginIndicator}" DisplayAfter="0">
<!--Button code inside of grid-->
    </telerik:RadBusyIndicator>
 
  private async void InstructorLoginButton_Click(object sender, RoutedEventArgs e)
        {
 
            MainMenuViewModel pageViewModel = (this.DataContext as MainMenuViewModel);
 
            pageViewModel.ShowLoginIndicator = true;
 
            try
            {
                //Do login stuff
            }
            catch (UserLoginException ule)
            {
                pageViewModel.SetInstructorLoginError(ule.Message);
            }
 
            pageViewModel.ShowLoginIndicator = false;
 
        }

View Model Code the indicator never shows but if I remove the async call it shows up.

      private RelayCommand studentLoginCommand;
        public RelayCommand StudentLonginCommand
        {
            get
            {
                return studentLoginCommand = studentLoginCommand ?? new RelayCommand(async() =>
                {
                    ShowLoginIndicator = true;
                    
 
                    bool isStudentloggedIn = await LoginStudent();
if (isStudentloggedIn)
{
//Handle login
ShoLoginIndicator=false;
 
                    }
                    else
                    {
                        ShowLoginIndicator = false;
                    }
                });
            }
        }

 

Nasko
Telerik team
 answered on 05 May 2016
7 answers
227 views

Hi,

this is the strange behavior:

I have a RadGridView its ItemSource setted with a VirtualQueryableCollectionView.

User set a filter and then export, I use this method:

public static void ExportToExcel(RadGridView p_GridView)
{
    if (p_GridView == null)
        return;
 
    var view = p_GridView.ItemsSource as VirtualQueryableCollectionView;
    int loadSize = view.LoadSize;
 
    view.LoadSize = p_GridView.Items.TotalItemCount;
 
    string extension = "xlsx";
 
    SaveFileDialog dialog = new SaveFileDialog()
    {
        DefaultExt = extension,
        Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, "Excel"),
        FilterIndex = 1
    };
 
    if (dialog.ShowDialog() == DialogResult.OK)
    {
        using (Stream stream = dialog.OpenFile())
        {
            p_GridView.ElementExportingToDocument += P_GridView_ElementExportingToDocument;
            p_GridView.ExportToXlsx(stream,
                new GridViewDocumentExportOptions()
                {
                    ShowColumnFooters = true,
                    ShowColumnHeaders = true,
                    ShowGroupFooters = true
                });
        }
 
        System.Diagnostics.Process.Start(dialog.FileName);
    }
 
    view.LoadSize = loadSize;
}

Sometimes it exports with first row of sheet dirty, because in first row there isn't columns header, but a row that does not belong to the collection (filtered by user).

PS: Normally, the first times export correctly header row (columns label), after several times appears that showed in SequenceExport.PNG

 

Dilyan Traykov
Telerik team
 answered on 05 May 2016
2 answers
792 views

I want whenever an item is added for it to start expanded.

My treeview is bound to a viewmodel.

I am using code examples from the forums to bind the isexpanded to a viewmodel isexpanded property like below.

The code worked for a bit and then recently stopped . the treeview does not render at all if the style is applied. if I remove the style it works fine.

Any ideas. is there a simpler way to do it .

Any help would be appreciated.

 

<Style TargetType="{x:Type telerik:RadTreeViewItem}" x:Key="Cola"  >
    <Setter Property="IsSelected" Value="{Binding Path=IsSelected,Mode=TwoWay}"  />
    <Setter Property="IsExpanded" Value="{Binding Path=IsExpanded,Mode=TwoWay}"/>
</Style>

<telerik:RadTreeView Grid.Row="0" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"  Margin="4"
                       SelectedItem="{Binding SelectedTreeViewModel,Mode=TwoWay}" ItemContainerStyle="{StaticResource Cola}"
                       ItemsSource="{Binding TreeViewModels}"  >
      <telerik:RadTreeView.ItemTemplate>
          <HierarchicalDataTemplate ItemsSource="{Binding TreeViewModels}"  >
              <StackPanel Orientation="Horizontal" >
                  <Image Source="{Binding Image}" Height="16" Width="16" VerticalAlignment="Center"  />
                  <TextBlock Text="{Binding Name}" Margin="4,0,0,0" VerticalAlignment="Center" />
              </StackPanel>
          </HierarchicalDataTemplate>
      </telerik:RadTreeView.ItemTemplate>
  </telerik:RadTreeView>

David Ocasio
Top achievements
Rank 2
Iron
Veteran
Iron
 answered on 04 May 2016
1 answer
68 views
Is it possible to change the layout of MapScale control -> display the Text block next to the rectangle, not under it? 
Yarema
Top achievements
Rank 1
 answered on 04 May 2016
5 answers
270 views

I want to put a circle of a certain radius on a map, that can be selected and I can move it around with a mouse.

SelectionChanged event is only available on VisualizationLayer, however I cannot put MapEllipse or MapEllipseView on the layer - I see nothing. With MapEllipse, for example - when I put it onto the InformationLayer it is displayed properly. But I cannot do anything with selection on that layer... I could use EllipseData, but that doesn't have HotSpot property, and I would like to set the hotspot to the center of the shape rather than left upper corner as it is by default.

Do you have any tips how I can reach my goal?

Dinko | Tech Support Engineer
Telerik team
 answered on 04 May 2016
7 answers
276 views

Hi everybody,

 

I'm using a RadRibbonView. When the window is full screen, i've no problem (file_1).

When the window is more small, the width of RadRibbonView is decreasing, and the RadRibbonTab witdh, too (file_2). The components are grouped in the same menu ("Navigation").

But, the space between the title ("Navigation") and his components is created (file_3), and I can't delete it.

 

My code :

<telerik:RadRibbonView Grid.Row="0" Grid.Column="1" HelpButtonVisibility="Hidden" ApplicationButtonVisibility="Hidden" 
                                        TitleBarVisibility="Collapsed" HorizontalAlignment="Left" TitleBarBackground="{x:Null}" 
                                        IsMinimizable="False" Height="82">

I've tried to change de Height ("Auto" for example"), but it dosen't work.

 

<telerik:RadRibbonTab Header="Graphiques" Height="Auto" VerticalAlignment="Top" >

(The all of RadRibbonTab have the similar code)

<telerik:RadRibbonGroup Header="Navigation" Height="Auto" VerticalAlignment="Top">

(The all of RadRibbonGroupe have the similar code)

Martin
Telerik team
 answered on 04 May 2016
3 answers
349 views
Hi.

I'm using a grid that has parent child heirarchy details using heirarchychildtemplate using MVVM and EF. There is a plus sign in the left-most column for the user to click on to expand the row. When the user clicks on a cell in the row, the details expand normally and the row is selected. But when the user just clicks on the plus sign, the row is expanded but the row does not get selected and SelectedItem is not changing. But according to our functionality, selected item should be updated when the user clicks on the expand button also. 

Please give an idea how to change the selected item of the radgriew of the parent grid when the user clicks on the expand button of the left-most column of the gridview.

I'm relatively new to WPF so apologies if I'm overlooking the obvious

Thanks & Regards
Somasekharan Thampi S
Stefan
Telerik team
 answered on 04 May 2016
Narrow your results
Selected tags
Tags
GridView
General Discussions
Chart
RichTextBox
Docking
ScheduleView
ChartView
TreeView
Diagram
Map
ComboBox
TreeListView
Window
RibbonView and RibbonWindow
PropertyGrid
DragAndDrop
TabControl
TileView
Carousel
DataForm
PDFViewer
MaskedInput (Numeric, DateTime, Text, Currency)
AutoCompleteBox
DatePicker
Buttons
ListBox
GanttView
PivotGrid
Spreadsheet
Gauges
NumericUpDown
PanelBar
DateTimePicker
DataFilter
Menu
ContextMenu
TimeLine
Calendar
Installer and Visual Studio Extensions
ImageEditor
BusyIndicator
Expander
Slider
TileList
PersistenceFramework
DataPager
Styling
TimeBar
OutlookBar
TransitionControl
FileDialogs
Book
ToolBar
ColorPicker
TimePicker
MultiColumnComboBox
SyntaxEditor
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
WatermarkTextBox
DesktopAlert
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
LayoutControl
ProgressBar
Sparkline
TabbedWindow
ToolTip
CloudUpload
ColorEditor
TreeMap and PivotMap
EntityFrameworkCoreDataSource (.Net Core)
HeatMap
Chat (Conversational UI)
VirtualizingWrapPanel
Calculator
NotifyIcon
TaskBoard
TimeSpanPicker
BulletGraph
Licensing
WebCam
CardView
DataBar
FilePathPicker
PasswordBox
SplashScreen
Callout
Rating
Accessibility
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Bohdan
Top achievements
Rank 3
Iron
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Elliot
Top achievements
Rank 1
Iron
Iron
Iron
Sunil
Top achievements
Rank 1
Cynthia
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?