Telerik Forums
UI for WPF Forum
1 answer
103 views
Hello, 

I have a problem, 
How we can use personal convertors on labels on AxisX?

For instance : 
data(int) :3600,7200,10800
label(string) :1h,2h,3h

We need to use integers in our datas but labels need to be custom strings.

Best regards,
Yavor
Telerik team
 answered on 26 May 2011
2 answers
311 views
Hello Support-Team,

i'd like to customize the RadComboBox to have a masked input with autocompletion.

 
<telerik:RadComboBox x:Name="maskedComboBox"                      
 ItemsSource="{Binding Path=ValuesViewModel.ExistingValues}"
 DisplayMemberPath="ValueName" SelectedValuePath="ValueId"
 SelectedValue="{Binding Path=ValuesViewModel.SelectedValue, UpdateSourceTrigger=PropertyChanged}"
 CanAutocompleteSelectItems="True" IsFilteringEnabled="True" TextSearchMode="StartsWith"
 OpenDropDownOnFocus="True" IsEditable="True"
 EditableTemplate="{DynamicResource MaskedComboBoxEditableTemplate}" />

As far as I've read the only way to reach that is to customize the EditableTemplate,
so I used Blend to get me a copy to work on.
At first I exchanged the original PickerTextBox PART_EditableTextBox simply with a
RadMaskedTextBox, which of course didn't work out the way I wanted.
So I unsuccessfully tried to find a nice example, in which someone needed the same or a similar customization.

Because of that I decided to leave the PickerTextBox the way it is and just show a MaskedTextBox instead of
the PickerTextBox and bind the MaskedTextBox.Value-property to the PickerTextBox.Text-property.
That at least worked for the filtering, but I lost theOpenDropDownOnFocus, most likely because I need the
focus on the PickerTextBox.

Code snippet of PART_EditableTextBox:

<telerik:PickerTextBox x:Name="PART_EditableTextBox"
 BorderThickness="{TemplateBinding BorderThickness}"
 Background="{TemplateBinding Background}"
 Grid.Column="0"Visibility="Collapsed"
 HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
 IsReadOnly="{TemplateBinding IsReadOnly}"
 Padding="{TemplateBinding Padding}"
 VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
 Text="{Binding ElementName=maskedTextBox, Path=Value, Mode=TwoWay}" >
 <telerik:StyleManager.Theme>
  <telerik:Office_BlackTheme/>
 </telerik:StyleManager.Theme>
</telerik:PickerTextBox>
 
<Controls:RadMaskedTextBox x:Name="maskedTextBox"
 Grid.Column="0"
 Mask="{Binding Path=SizeChartViewModel.SizeChartMask.Mask}"
 MaskType="Standard"
 SelectionOnFocus="CaretToBeginning"
 BorderThickness="{TemplateBinding BorderThickness}"
 Background="{TemplateBinding Background}"
 HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
 IsReadOnly="{TemplateBinding IsReadOnly}" Padding="{TemplateBinding Padding}"
 VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}">
 <telerik:StyleManager.Theme>
  <telerik:Office_BlackTheme/>
 </telerik:StyleManager.Theme>
</Controls:RadMaskedTextBox>

Is there any better approach to customize the ComboBox to get what I need?
Or is there any workaround to get my changes of the EditableTemplate to work the way I want it to?

Thank you!


										
Björn
Top achievements
Rank 1
 answered on 26 May 2011
0 answers
81 views
Hi Support,

I have some queries in Telerik controls as follows.

Please check the below with Both WPF/Silverlight.

1. Does Telerik Have DataGrid with RichText Box cell type.
2. If so, Can i export and import the content of Richt Text box in DataGrid to Excel  and viseversa.
3. Can i copy the content of the RTB cell and paste in Excel to obtain the same formatted text.

Thanks
Kamal.
kamal
Top achievements
Rank 1
 asked on 26 May 2011
2 answers
413 views
I start to use mvvm pattern and i have situation like this:
On my View I have RadGridView implement in this way. On View exist button "Edit". When user click on this button i show new window to edit SelectedNews (in constructor i give this object). I implement IEditableObject on NewsModelItem. Problem is that when i click "Close" on my edit window and i call NewModelitem.EndEdit() my RadGridView is not refresh.
<telerik:RadGridView  DockPanel.Dock="Top" Width="auto"  SelectedItem="{Binding SelectedNews,Mode=TwoWay}"
                                    ItemsSource="{Binding NewsModelDTO.NewsItems}" 
                                    Grid.Row="0"
                                    AutoGenerateColumns="False" 
                                    CanUserDeleteRows="False"
                                    CanUserInsertRows="False"
                                    CanUserSelect="True"
                                    GridLinesVisibility="Horizontal"
                                    ShowInsertRow="False"
                                    ShowGroupFooters="False"
                                    ShowColumnHeaders="True"
                                    RowIndicatorVisibility="Collapsed">
              <telerik:RadGridView.Columns>
                      <telerik:GridViewDataColumn Header="UsuÅ„" DataMemberBinding="{Binding NewsIsSelected}"
                         IsReadOnly="True">
                          <telerik:GridViewDataColumn.CellTemplate>
                              <DataTemplate>
                                  <CheckBox IsChecked="{Binding NewsIsSelected, Mode=TwoWay}"/>
                              </DataTemplate>
                          </telerik:GridViewDataColumn.CellTemplate>
                      </telerik:GridViewDataColumn>
                      <telerik:GridViewDataColumn IsReadOnly="True" MaxWidth="200"  Header="Nazwa" DataMemberBinding="{Binding NewsTitle}" />
                      <telerik:GridViewDataColumn IsReadOnly="True" Width="0.4*" Header="Treść" DataMemberBinding="{Binding NewsText}" />
                      <telerik:GridViewDataColumn IsReadOnly="True" Width="120"  Header="Uruchom" DataMemberBinding="{Binding NewsDateFrom}"/>
                      <telerik:GridViewDataColumn IsReadOnly="True" Width="120"  Header="ZakoÅ„cz" DataMemberBinding="{Binding NewsDateTo}"/>
                      <telerik:GridViewCheckBoxColumn IsReadOnly="True" Width="120" Header="Czy aktywny" DataMemberBinding="{Binding NewsIsactive}"/>
              </telerik:RadGridView.Columns>
              </telerik:RadGridView>

In my VM class i have:
public class UcCommunicatesViewModel : ViewModelBase 
    {
        private NewsModelDTO newsModelDTO = new NewsModelDTO();
        private NewsServiceClient newsService;
        private NewsItemModel selectedNews;
        private RelayCommand addNewsCommand;
        private RelayCommand editNewsCommand;
        private RelayCommand deleteNewsCommand;
  
        public RelayCommand AddNewsCommand
        {
            get
            {
                if (addNewsCommand == null)
                {
                    addNewsCommand = new RelayCommand(param => this.AddNewNews(),
                        param => this.CanAddNewNews());
                }
                return addNewsCommand;
  
            }
        }
  
        public RelayCommand EditNewsCommand
        {
            get
            {
                if (editNewsCommand == null)
                {
                    editNewsCommand = new RelayCommand(param => this.EditNews(),
                        param => this.CanEditNews());
                }
                return editNewsCommand;
            }
        }
  
        public RelayCommand DeleteNewsCommand
        {
            get
            {
                if (deleteNewsCommand == null)
                {
                    deleteNewsCommand = new RelayCommand(param => this.DeleteNews(),
                        param => this.CanDeleteNews());
                }
                return deleteNewsCommand;
            }
        }
  
        public bool CanAddNewNews()
        {
             
            return true;
        }
  
        public bool CanEditNews()
        {
            if (SelectedNews == null) return false;
            else return true;
        }
  
        public bool CanDeleteNews()
        {
            foreach (NewsItemModel ni in newsModelDTO.NewsItems)
            {
                if (ni.NewsIsSelected) return true;
            }
            if (SelectedNews == null) return false;
            else return true;
        }
  
        public void AddNewNews()
        {
            AddNewsPopup popup = new AddNewsPopup(false,new NewsItemModel());
            popup.ShowDialog();
            
            if (popup.DialogResult == true)
            {
                FillDataGrid();
                OnPropertyChanged("NewsModelDTO");
            }
            else
            {
               
            }
        }
        public void EditNews()
        {
            AddNewsPopup popup = new AddNewsPopup(true,SelectedNews);
            popup.ShowDialog();
            if (popup.DialogResult == true)
            {
                FillDataGrid();
                OnPropertyChanged("NewsModelDTO");
            }
            else
            {
                OnPropertyChanged("SelectedNews");
                OnPropertyChanged("NewsModelDTO");
            }
             
        }
        public void DeleteNews()
        {
              
              
        }
        public NewsServiceClient NewsService
        {
            get { return newsService; }
            set { newsService = value; }
        }
  
        public NewsModelDTO NewsModelDTO
        {
            get { return newsModelDTO; }
            set 
            {
                newsModelDTO = value;
                OnPropertyChanged("NewsModelDTO");
            }
        }
  
        public NewsItemModel SelectedNews
        {
            get { return selectedNews; }
            set
            {
                selectedNews = value;
                OnPropertyChanged("SelectedNews");
            }
        }
  
        public UcCommunicatesViewModel()
        {
            EndpointAddress endpointAddress = new EndpointAddress("http://localhost:5737/Service/NewsService.svc");
            newsService = new NewsServiceClient(new BasicHttpBinding(), endpointAddress);
            FillDataGrid();
        }
        
        private void FillDataGrid()
        {
            NewsDTO newsDto = newsService.GetNews();
            NewsModelDTO NewsModelDTOCpy = new NewsModelDTO();
            foreach (NewsItem ni in newsDto.NewsItems)
            {
                NewsItemModel nim = new NewsItemModel
                (
                  ni.NewsId,
                  ni.NewsTitle,
                  ni.NewsText,
                  ni.NewsDatefrom,
                  ni.NewsDateto,
                  ni.NewsIsactive
                );
                NewsModelDTOCpy.NewsItems.Add(nim);
            }
            newsModelDTO = NewsModelDTOCpy;
  
        }
       
    }

And my edit window
public class AddNewsPopupViewModel : ViewModelBase
    {
        private NewsItemModel newsItem;
        private RelayCommand saveNewsCommand;
        private RelayCommand closeCommand;
  
        private NewsServiceClient newsService;
        private bool isEditMode=false;
        public event Action RequestClose;
  
        public AddNewsPopupViewModel(bool isEditMode, NewsItemModel newsItem)
        {
            this.newsItem = newsItem;
            this.isEditMode = isEditMode;
            if (isEditMode)
            {
               ((IEditableObject)newsItem).BeginEdit();
            }
        }
  
        public RelayCommand SaveNewsCommand
        {
            get
            {
                if (saveNewsCommand == null)
                {
                    saveNewsCommand = new RelayCommand(param => this.SaveNews(), param => this.CanSaveNews());
                }
                return saveNewsCommand;
            }
        }
  
        public RelayCommand CloseCommand
        {
            get
            {
                if (closeCommand == null)
                {
                    closeCommand = new RelayCommand(param => Close(), param => CanClose());
                }
                return closeCommand;
            }
        }
  
        public bool CanSaveNews()
        {
            if (newsItem.NewsText == string.Empty || newsItem.NewsTitle == string.Empty)
            {
                return false;
            }
            return true;
        }
  
        public NewsItemModel NewsItem
        {
            get { return newsItem; }
            set
            {
                newsItem = value;
                OnPropertyChanged("NewsItem");
            }
        }
  
        public void SaveNews()
        {
            EndpointAddress endpointAddress = new EndpointAddress("http://localhost:5737/Service/NewsService.svc");
            newsService = new NewsServiceClient(new BasicHttpBinding(), endpointAddress);
            if (isEditMode)
            {
                NewsItem itemToSave = ReWriteDataToServiceItem(newsItem);
                newsService.SaveEditedNews(itemToSave);
                ((IEditableObject)NewsItem).EndEdit();
                Common.MessageBox.Show("Dane zostaÅ‚y zapisane", "Informacja", MessageBox.MesageBoxButtons.OK, MessageBox.MessageBoxImage.Information);
                DialogResult = true;
                this.Close();
            }
            else
            {
               NewsItem itemToSave = ReWriteDataToServiceItem(newsItem);
               newsService.AddNews(itemToSave);
               Common.MessageBox.Show("Dane zostaÅ‚y zapisane", "Informacja", MessageBox.MesageBoxButtons.OK, MessageBox.MessageBoxImage.Information);
               DialogResult = true;
               this.Close();
               
            }
        }
        public NewsItem ReWriteDataToServiceItem(NewsItemModel newsItemModel)
        {
            NewsItem newsItemService = new NewsItem();
            newsItemService.NewsId = newsItemModel.NewsId;
            newsItemService.NewsText = newsItemModel.NewsText;
            newsItemService.NewsTitle = newsItemModel.NewsTitle;
            newsItemService.NewsDatefrom = newsItemModel.NewsDateFrom;
            newsItemService.NewsDateto = newsItemModel.NewsDateTo;
            newsItemService.NewsIsactive = newsItemModel.NewsIsActive;
            return newsItemService;
        }
        
  
        public virtual void Close()
        {
            if (isEditMode)
            {
               ((IEditableObject)NewsItem).CancelEdit();
  
            }
            if (RequestClose != null)
            {
                RequestClose();
            }
        }
  
        public virtual bool CanClose()
        {
            return true;
        
         
          
         
    }
Marcin
Top achievements
Rank 1
 answered on 26 May 2011
1 answer
116 views
hi all
when we have flowdocumentscroller in radbook then how can add annotation to texts in flowdocumentscoller?
thankful.
Tina Stancheva
Telerik team
 answered on 25 May 2011
1 answer
78 views
hi all
i add several text to an list<run> and assign radbook itemssource to it.
several of my text is biggest page and dont show.
how can i show that text?
can wrap text in next page or add an scroll to scroll page?
thankful.
Tina Stancheva
Telerik team
 answered on 25 May 2011
1 answer
151 views
hi all
i have 2 xml file and an treeview and an flowdocumentscrollviewer when i select an item from treeview its text in xml read and show in flowdocumentscrollviewer .

first xml file:
<books Name="a" >
    <book Name="" Index="1" Media="1.mp3">
        
    </book>
    <book Name="b" Index="2" Media="2.mp3">
         
    </book>
</books>

second xml file:
<text>
  <mainText>
     text1
  </mainText>
  <mainText>
   text2
  </mainText>
  </text>

i want replace flowdocumentscrollviewer with an book interface.
how can do this?
thankful.
Tina Stancheva
Telerik team
 answered on 25 May 2011
6 answers
137 views
I have a grid with the HorizontalAlignment set to left so that I get a nice compact grid.  When the grid is first loaded with data, the columns auto-size to properly fit the contents.  When the grid is first loaded, the IsFilteringAllowed is set to false and it is bound to a ViewModel for this property.

IsFilteringAllowed="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type UserControl}}, Path=DataContext.IsAdvancedUserInterfaceOn}"

We have allowed the user the ability to toggle this on and off.  When the user toggles it to true.  The columns properly resize to fit the filter indicator for each column.

However when the user toggles this off, setting the toggle to false, the indicator disappears, but the columns retain their size.  Here's a screenshot describing the issue.

I looked but I don't see a method to call to resize the columns back to their original size.  Can you help?
Rossen Hristov
Telerik team
 answered on 25 May 2011
10 answers
1.4K+ views

I using radGridView containing two columns, one is of a plain text type and the other one is of a Rich Text (RadRichTextBox).

In order to implement it, I’ve set the grid column’s CellTemplate property (as shown in the following code).

Inside the cell, the data is being shown correctly. But the cell is being drawn with large margins (which become more noticeable when the row is selected or is the current row).
(Screenshot -
http://imageshack.us/photo/my-images/864/radgriditemcontainersty.gif/ )

When clicking on those margins the cell’s content disappears.

What do I need to do in order to eliminate the cell margin?

Code:

<Window x:Class="GridTesting.MainWindow"

        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"       

        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"

        xmlns:telerikProvider="clr-namespace:Telerik.Windows.Documents.FormatProviders.Html;assembly=Telerik.Windows.Documents.FormatProviders.Html"

        Title="MainWindow" Height="350" Width="780" x:Name="GridTesting"

        >

    <Grid>

        <telerik:RadGridView

                                 CanUserReorderColumns="True" ReorderColumnsMode="ReorderColumns"

                                 RowIndicatorVisibility="Visible" SelectionMode="Extended" ShowGroupPanel="False"

                                 CanUserInsertRows="True" ShowInsertRow="False" CanUserDeleteRows="True" DragElementAction="None"

                                 ItemsSource="{Binding ItemsSource, ElementName=GridTesting}" AutoGenerateColumns="False">

            <telerik:RadGridView.Columns>

                <telerik:GridViewDataColumn Header="Name" Width="2*" >

                    <telerik:GridViewDataColumn.CellTemplate>

                        <DataTemplate>

                            <StackPanel>

                                <TextBox Text="{Binding Name, Mode=TwoWay}"

                                         HorizontalAlignment="Stretch" VerticalAlignment="Stretch" TextWrapping="Wrap"

                                                             BorderThickness="0" Padding="0" Margin="0" MaxHeight="100"/>

                            </StackPanel>

                        </DataTemplate>

                    </telerik:GridViewDataColumn.CellTemplate>

                </telerik:GridViewDataColumn>

                <telerik:GridViewDataColumn Header="Description" Width="5*">

                    <telerik:GridViewDataColumn.CellTemplate>

                        <DataTemplate>

                            <StackPanel>

                                <telerik:RadRichTextBox x:Name="DescriptionRichTextBox" AcceptsTab="False" MaxHeight="100" BorderThickness="0" IsSpellCheckingEnabled="False" />

                                <telerikProvider:HtmlDataProvider RichTextBox="{Binding ElementName=DescriptionRichTextBox}" Html="{Binding Description, Mode=TwoWay}" />

                            </StackPanel>

                        </DataTemplate>

                    </telerik:GridViewDataColumn.CellTemplate>

                </telerik:GridViewDataColumn>

            </telerik:RadGridView.Columns>

        </telerik:RadGridView>

    </Grid>

</Window>

(I also tried to change the ItemContainerStyle, but without success)

Rotem
Top achievements
Rank 1
 answered on 25 May 2011
1 answer
245 views

Hi Telerik,

I'm working with RadControls for WPF Q1 2011 and PRISM 4 - MVVM. I need to add a view into a floating window programmatically. The goal is when my main window displayed, a floating window (another view) will also be displayed. The MVVM module will pass the view into the floating window, hence I need to define a region within the window. Is it possible to achieve and how?

Thank you,
Agung

George
Telerik team
 answered on 25 May 2011
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?