Telerik Forums
UI for WPF Forum
7 answers
293 views
Telerik provide a SelectedItemsBehavior example for two-way binding of SelectedItems. It is on GitHub here:
https://github.com/telerik/xaml-sdk/tree/master/GridView/BindingSelectedItemsFromViewModel

Original blog post from 2010 here: http://blogs.telerik.com/vladimirenchev/posts/10-05-31/how-to-synchronize-your-ui-selected-items-with-your-data-context-using-mvvm-and-blend-behaviors-for-silverlight-and-wpf.aspx

In my experience, and as others have reported, it is a little buggy:
1. It will crash in the Transfer() method intermittently. 
For example, this was reported by another user: I used the solution suggested in the last comment by Vlad from github, it worked fine, but sometimes I am getting the error "cannot change observablecollection during a collectionchanged event". I also get this error.

2. If you change the DataContext, then the SelectedItems collection no longer gets updated.

I have developed some very simple fixes and now it works beautifully. First of all, we only subscribe to events once. Second, we only attach ourselves to the grid once.

Here is a pull request - maybe the mods will merge it in:
https://github.com/HolbergEEG/xaml-sdk/commit/30ae7a8ebe0513674921f72b3dff1d4332dd63a9

Stefan
Telerik team
 answered on 22 Feb 2016
3 answers
295 views

I have a RadExpander on a UserControl. The datacontext of the UserControl (and therefor of the RadExpander) is bound to the selecteditem of a RadDataGrid (a list/details solution).The datacontext is a viewmodel and all my viewmodels implements INotifyPropertyChanged.

The first time I select an item in my datagrid, it goes well. After that, the pink textblock shows the previous Name (string) while the green shows the current.

That seems like a bug to me.

I cant just use the green one, because in my real solution I need to do complex stuff with datatriggers, but this is what it boils down to.

Here is the XAML, and I have attached a picture from my running program:

<telerik:RadExpander x:Name="_myExpander" Grid.Column="0" Grid.Row="2"  ExpandDirection="Down"
               ToolTipService.Placement="Center" HorizontalContentAlignment="Stretch" Margin="0,0,2,0">
           <telerik:RadExpander.Style>
               <Style TargetType="{x:Type telerik:RadExpander}">
                   <Setter Property="IsExpanded" Value="True" />
                   <Style.Triggers>
                       <DataTrigger Binding="{Binding}" Value="{x:Null}">
                           <Setter Property="IsExpanded" Value="False" />
                       </DataTrigger>
 
                   </Style.Triggers>
               </Style>
           </telerik:RadExpander.Style>
           <telerik:RadExpander.Header>
               <Border Margin="2, 0, -8, 0" Background="White" MinHeight="22">
                   <Grid  VerticalAlignment="Stretch">
                       <Grid.ColumnDefinitions>
                           <ColumnDefinition Width="Auto"/>
                           <ColumnDefinition Width="*"/>
                       </Grid.ColumnDefinitions>
 
                       
                        
                       <Grid  Margin="2,2,4,2"  Grid.Column="0"
                               Background="LightPink">
                           <TextBlock >
                               <TextBlock.Style>
                                   <Style TargetType="{x:Type TextBlock}">
                                       <Setter Property="Text" Value="{Binding Name}" />
                                   </Style>
                               </TextBlock.Style>
                           </TextBlock>
                       </Grid>
                        
                       <Grid  Margin="14,2,4,2"  Grid.Column="1"
                               Background="DarkSeaGreen">
                           <TextBlock Text="{Binding Name}" />
                       </Grid>
                                
                   </Grid>
               </Border>
           </telerik:RadExpander.Header>
           <telerik:RadExpander.Content>
           <TextBlock Margin="24,24,2,2" Text="Body" />
 
 
           </telerik:RadExpander.Content>
       </telerik:RadExpander>

Kiril Vandov
Telerik team
 answered on 22 Feb 2016
3 answers
272 views

for our RadDiagramShapes, we have a Style that includes the Setter:

<Setter Property="Visibility" Value="{Binding Visibility}" />

When we have a these shapes in a diagram with DiagramSurface.IsVirtualizing set to false, the binding appears as expected.  However, when we enable virtualization, we see via Snoop that the binding on that property has instead been set locally to a path of "(0)".

We use Visibility to control, oddly enough, the visibility of elements in our diagram.  Can you all offer any insights into what's going on and also what we could do to work around this while still having virtualization enabled, please?

This is with UI for WPF v. 2015.2.0401.

 

Thanks,

 

-David

 

Kiril Vandov
Telerik team
 answered on 22 Feb 2016
3 answers
461 views
For some reason, I'm unable to apply a LabelText attribute on the RadDataBar. Its ControlTemplate contains a TextBlock which uses TemplateBinding to bind to the AppliedLabelMargin and LabelText properties, but they're not available.

What gives?
Evgenia
Telerik team
 answered on 22 Feb 2016
10 answers
3.0K+ views
How do you center the checkbox in the GridViewCheckBoxColumn? My stays Left aligned. I tried setting the TextAlignment to center, but it does nothing.
Toffer
Top achievements
Rank 2
 answered on 19 Feb 2016
3 answers
157 views

I used this method to fix the empty combo box

 

http://docs.telerik.com/devtools/wpf/controls/radgridview/troubleshooting/blank-cells.html

 

I have a Usercontrol called relationship that uses that fix. 

At the moment I have to create 4 different UserControls because each is pointing to a different viewmodel. Is there a way to have it dynamic so it can point to any.

<UserControl.Resources>
    <local:MainPageViewModel1 x:Key="mainPageViewModel1" />
    <local:MainPageViewModel2 x:Key="mainPageViewModel2" />
    <local:MainPageViewModel3 x:Key="mainPageViewModel3" />
</UserControl.Resources>
...
<telerik:GridViewComboBoxColumn Header="Category"
        DataMemberBinding="{Binding CategoryID}"
        ItemsSource="{Binding Path=Categories, Source={StaticResource CHOOSE CORRECT VM}}"
        DisplayMemberPath="CategoryName"
        SelectedValueMemberPath="CategoryID" />

Stefan
Telerik team
 answered on 19 Feb 2016
1 answer
249 views

Hello,

 I have built a radgridview and binded to selectedItems. This works great and as I imagined until I filter the grid (using the default telerik filtering) on a column and then selecting a new item which selectedItems is null. Can someone please help me understand what is difference for selecteditems with the entire collection and a filtered collection? And why the binding is null after being filtered? Thank you. 

 Below is my binding.

<telerik:RadGridView x:Name="radGridView" GroupRenderMode="Flat"
Width="Auto"
Height="Auto"
MaxHeight="500"
CanUserFreezeColumns="True"
RowIndicatorVisibility="Collapsed"
AutoGenerateColumns="False"
Grid.Row="0"
ShowGroupPanel="False"
ItemsSource="{Binding GridModels}"
SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
RowEditEnded="RadGridView_RowEditEnded">

 

Once again, this works great until I filter and then try selecting a new row (I am not selecting and then filtering).

Petya
Telerik team
 answered on 19 Feb 2016
1 answer
123 views

Hi,

I am facing issues in copying the PNG files in to rich text box. 

I have an 2 PNG files, one of theirs Layout format is "Square", the other ones Layout format is "Inline with text". 

File with the Layout format of "Square" is copied properly, where as the "Inline with Text" doesn't get copied over as image. Instead, its pasted as a very long text of binaries or strings.

ClipboardEx.GetDocument(); gets Image as span with long text rather than the ImageInline.

Could some one help in fixing this issue please ? Do we have paste special option in Telerik ?

Thanks

Tanya
Telerik team
 answered on 18 Feb 2016
3 answers
732 views
Good morning,
My company is looking at using the RadRichTextBox control for rendered, editing, and exporting Docx documents. I am attempting to write a small test app as a proof-of-concept but I've hit a problem I can't get around. In all of the demos/tutorials I am seeing online they are creating a DoxFormatProvider and using it to create a document like the following:

using( Stream readStream = dialog.OpenFile() )
{
   IDocumentFormatProvider provider = new DocxFormatProvider();
   RadDocument = provider.Import( readStream );
}

Unfortunately what I am seeing is that DocxFormatProvider will not cast to an IDocumentFormatProvider. DocxFormatProvider appears to be a BinaryFormatProviderBase<RadFlowDocument> found in the Telerik.Windows.Documents.Flow assembly. The DocxFormatProvider returns a RadFlowDocument rather than a RadDocument which I have been unable to find a way to get a RadFlowDocument to work in the RadRichTexTextBox control.

It appears like all other providers have their own DLL following the pattern Telerik.Windows.Documents.FormatProviders.XXX.dll where XXX is the provider type but I do not see a Docx DLL. The assemblies I am working with are 2014.2.729.45. Any guidance would be greatly appreciated. Thanks!
Jason
Michael
Top achievements
Rank 1
 answered on 17 Feb 2016
1 answer
121 views

hi, im using current Telerik WPF Q1 2015 and also try using current and i have a problem in my project with DocumentTextSearch. the function is to load  document xaml template and find text string and replace with table. but i have problem with DocumentTextSearch when searching text string from RadDocument its keep hanging when try to find text string. my code is like bellow : 

  public void ReplaceTable(ref RadDocument doc, string searchitem, Table RefTable)
        {
            doc.BeginUpdate();
            try
            {
                using (DocumentPosition startFindPosition = new DocumentPosition(doc.DocumentLayoutBox, true))
                {
                    var found = true;

                    while (found)
                    {
                        DocumentTextSearch textSearch = new DocumentTextSearch(doc);
                        TextRange find = textSearch.Find( Regex.Escape(searchitem), startFindPosition);

                        found = find != null;

                        if (found)
                        {
                            startFindPosition.MoveToPosition(find.EndPosition);
                            startFindPosition.AnchorToNextFormattingSymbol();

                            doc.CaretPosition.MoveToPosition(find.StartPosition);
                            find.SetSelection(doc);

                            //doc.Delete(false);
                            //doc.IncreaseLeftIndent();
                            //if (RefTable.Rows.Count == 1)
                            //{
                            //    doc.Insert("-");

                            //}
                            //else
                            //{
                            //    doc.InsertTable(RefTable);
                            //}
                            doc.Selection.Clear();


                            startFindPosition.RemoveAnchorFromNextFormattingSymbol();
                        }
                    }
                   
                }
            }
            catch (Exception e) { }
            finally
            {
                doc.EndUpdate();
                
            }
        }

i wait your reply

 

Svetoslav
Telerik team
 answered on 17 Feb 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?