Telerik Forums
UI for WPF Forum
14 answers
135 views

We are currently replacing an old Infragistics docking manager with your control, and with the old code, we've prevented the floating of windows.

However, the user could still move panes around to a different location, and change the layout (Just like with DragDropMode is set to Deferred).

 

I would like to support the legacy mode (Which will be the default) which will behave just like the Deferred DragDropMode. I also want the user to be able to change an option in the program, which will change the DragDropMode to Immediate.

 

This, however, doesn't work as expected...

If changing from Immediate to Deferred:

* Docked panes are not movable (no compass and no deferred adorner is being shows)

* Floating panes that are being docked do have the compass and the deferred adorner, when you try to move them after they were docked. 

 

If you change is back from Deferred to Immediate:

* Panes that you could not move can be moved (and then become floating) again/

* The panes that did have  the compass and the deferred adorner, don't move when you try to drag them. However, when you release the mouse button, then the start moving with the mouse pointer... without any mouse button pressed.

 

Thanks

Nasko
Telerik team
 answered on 06 May 2016
1 answer
110 views

I am trying to export filtered records from radgrid.But it was importing all the records those are in my grid.

Please let me know how can i achieve this.here is the code snippet.

 string extension = "pdf";
            rgEquipmentTracking.ElementExporting -= rgEquipmentTracking_ElementExporting;
            rgEquipmentTracking.ElementExporting += rgEquipmentTracking_ElementExporting;            
            SaveFileDialog dialog = new SaveFileDialog()
            {
                DefaultExt = extension,
                Filter = String.Format("{1} files (.{0})|*.{0}|All files (.*)|*.*", extension, "Pdf"),
                FilterIndex = 1
            };
            var grid = new RadGridView()
            {
                
                ItemsSource = rgEquipmentTracking.ItemsSource,
                RowIndicatorVisibility = Visibility.Collapsed,
                ShowGroupPanel = false,
                CanUserFreezeColumns = false,
                IsFilteringAllowed = true,
                AutoExpandGroups = true,
                AutoGenerateColumns = false,
                Margin = new Thickness(30, 30, 30, 30),
                ShowColumnFooters = true,

                EnableRowVirtualization = true
            };
            
            foreach (var column in rgEquipmentTracking.Columns.OfType<GridViewDataColumn>())
            {
                if (column.IsVisible == true && column.UniqueName != "ViewDetail")
                {
                    var newColumn = new GridViewDataColumn();
                    newColumn.DataMemberBinding = new System.Windows.Data.Binding(column.UniqueName);
                    grid.Columns.Add(newColumn);
                    if (column.UniqueName == "ItemDate")
                    {
                        newColumn.UniqueName = "Sign Out Date";
                        newColumn.Header = "Sign Out Date";
                        newColumn.DataMemberBinding.StringFormat = "{0:dd/MM/yyyy}";
                    }
                }
            }


            StyleManager.SetTheme(grid, StyleManager.GetTheme(grid));
            if (dialog.ShowDialog() == true)
            {

                using (Stream stream = dialog.OpenFile())
                {     
                    
                    grid.ExportToPdf(stream,
                        new GridViewPdfExportOptions()
                        {
                            ExportDefaultStyles = true,
                            ShowColumnFooters = true,
                            ShowColumnHeaders = true,
                            ShowGroupFooters = true,
                            AutoFitColumnsWidth = true,
                            PageOrientation = PageOrientation.Landscape
                        });
                }
            }

Stefan Nenchev
Telerik team
 answered on 06 May 2016
1 answer
134 views

Hi,

it is easy to create GridView rows by button click. But is it possible to create rows for a month? I want to create
perhaps may. So i need 31 rows and in one column should be the Date from SO 01.05.2016 to  TUE 31.05.2016?

Thanks a lot
Best Regards
Rene

Stefan Nenchev
Telerik team
 answered on 06 May 2016
2 answers
175 views

So I'm trying to get the ScheduleView to allow a gridview and a listbox drop appointments (ScheduleItems) on it - and I can't seem to get the ConvertDraggedData to work properly because the ListBox sends through an IEnumerable<IOccurrence> and my GridView sends the raw item through (ScheduleItem).

So I rolled my own GridViewDragDropBehaviour class (as there isn't one built in for the GridView) and on the OnDragInitialize event, I'm using IDragPayload.SetData() to set the data to be the raw (ScheduleItem) item.  The ListBox is using the built in ListBoxDragDropBehaviour class.

This is my ConvertDraggedData code:

public override IEnumerable<IOccurrence> ConvertDraggedData(object data)
{
if (DataObjectHelper.GetDataPresent(data, typeof(ScheduleItem), false))
{
    return ((IEnumerable)DataObjectHelper.GetData(data, typeof(ScheduleItem), false)).OfType<IOccurrence>();
}
return base.ConvertDraggedData(data);
}

 

Obviously when items are dragged from the GridView the specified cast to IEnumerable doesn't work - but it works fine from the ListBox.  How do I tweak the code so that it will work for both controls?

Kieron
Top achievements
Rank 1
 answered on 06 May 2016
2 answers
102 views

Hi,

I'm saving by PersistenceMaganer on my GridView but when I try to reload it missed converter and formatstring in some column.

When reloading it doesn't apply Converter called FuoriCorsoConverter and StringFormat of "Last Update" column, durthermore other column with StringFormat is correctly applyed instead.

Why?

Codes:

//Portions of code for saving
PersistenceManager manager = new PersistenceManager();
var streamGridView = manager.Save(this.DocumentHostGridView);
//[...]
 
//Portion of code for loading
//[...]
private void LoadPersonalizzazione()
{
    //Personlizzazione del docking
    var stream = ViewModel.CaricaPersonalizzazione(this.GetType().ToString()); //ref. UserControl.xaml.cs
    if (stream != null)
        this.MainRadDocking.LoadLayout(stream);
 
    //Personalizzazione della gridview principale
    MemoryStream streamGridView = ViewModel.CaricaPersonalizzazioneControllo(this.GetType().ToString(),
        this.DocumentHostGridView.Name);
    if (streamGridView != null)
    {
        streamGridView.Position = 0L;
        PersistenceManager manager = new PersistenceManager();
        manager.Load(this.DocumentHostGridView, streamGridView);
    }
}
//[...]

XAML of columns

<telerik:GridViewDataColumn Header="Last Update" DataMemberBinding="{Binding UltimoAggiornamento, StringFormat={}{0:dd/MM/yyyy}}"/>
<telerik:GridViewImageColumn Header="Out" DataMemberBinding="{Binding FuoriCorso, Converter={StaticResource FuoriCorsoConverter}}"/>

Dario Concilio
Top achievements
Rank 2
 answered on 06 May 2016
4 answers
794 views
Hi

I'm in the process of moving from the WPF TreeView to RadTreeView. I noticed I lost some capability with mouse double click when I changed it over to RadTreeView

<telerik:RadTreeView x:Name="DeviceTreeView" Margin="2" VerticalContentAlignment="Top" ItemsSource="{Binding Recievers}" IsExpandOnDblClickEnabled="False">
 
                       <telerik:RadTreeView.Resources>
                           <HierarchicalDataTemplate
                               DataType="{x:Type ViewModel:RecieverViewModel}"
                               ItemsSource="{Binding Children}"
                                 >
                               <StackPanel Orientation="Horizontal" >
                                   <!-- <Image Width="16" Height="16" Margin="3,0" Source="Images\Region.png" /> -->
                                   <TextBlock Text="{Binding Id}">
                                       <TextBlock.InputBindings>
                                           <MouseBinding Gesture="LeftDoubleClick" Command="{Binding Path=DataContext.OpenRecieverVisTabCommand, RelativeSource={RelativeSource AncestorType={x:Type TreeView}}}" CommandParameter="{Binding Id}"/>
                                       </TextBlock.InputBindings>
                                   </TextBlock>
                               </StackPanel>
                           </HierarchicalDataTemplate>
 
                           <HierarchicalDataTemplate
                               DataType="{x:Type ViewModel:TripodViewModel}"
                               ItemsSource="{Binding Children}"
                                 >
                               <StackPanel Orientation="Horizontal" >
                                   <!-- <Image Width="16" Height="16" Margin="3,0" Source="Images\State.png" /> -->
                                   <TextBlock Text="{Binding Id}">
                                       <TextBlock.InputBindings>
                                           <MouseBinding Gesture="LeftDoubleClick" Command="{Binding Path=DataContext.OpenTripodVisTabCommand, RelativeSource={RelativeSource AncestorType={x:Type TreeView}}}" CommandParameter="{Binding Id}"/>
                                       </TextBlock.InputBindings>
                                   </TextBlock>
                               </StackPanel>
                           </HierarchicalDataTemplate>
 
                       </telerik:RadTreeView.Resources>
 
                       <telerik:RadTreeView.ItemContainerStyle>
                           <!--
                           This Style binds a TreeViewItem to a TreeViewItemViewModel.
                           -->
                           <Style TargetType="{x:Type telerik:RadTreeViewItem}">
                               <Setter Property="IsExpanded" Value="true" />
                               <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
                               <Setter Property="FontWeight" Value="Normal" />
                               <Style.Triggers>
                                   <Trigger Property="IsSelected" Value="True">
                                       <Setter Property="FontWeight" Value="Bold" />
                                   </Trigger>
                               </Style.Triggers>
                           </Style>
                       </telerik:RadTreeView.ItemContainerStyle>
 
                   </telerik:RadTreeView>

Basically, I'm binding the tree items to a double click to a command. It's not workign in RadTreeView, Any ideas?

Thanks, Dave
Daniele
Top achievements
Rank 1
 answered on 06 May 2016
6 answers
985 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
156 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
103 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
472 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
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
Book
FileDialogs
ToolBar
ColorPicker
TimePicker
SyntaxEditor
MultiColumnComboBox
VirtualGrid
Wizard
ExpressionEditor
NavigationView (Hamburger Menu)
DesktopAlert
WatermarkTextBox
BarCode
SpellChecker
DataServiceDataSource
EntityFrameworkDataSource
RadialMenu
ChartView3D
Data Virtualization
BreadCrumb
ProgressBar
Sparkline
LayoutControl
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
Rating
SplashScreen
Accessibility
Callout
CollectionNavigator
Localization
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Bronze
Iron
Iron
Sergii
Top achievements
Rank 1
Iron
Iron
Dedalus
Top achievements
Rank 1
Iron
Iron
Lan
Top achievements
Rank 1
Iron
Doug
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?