Telerik Forums
UI for WPF Forum
3 answers
310 views
Hi,
I have a query.I am developing WPF app and using MVVM Architecture.
 I have a RadListbox which gives the option of selecting multiple items.I want to access the selected items in my Viewmodel. How do i do it??

Thanks in advance

Shruti
Yana
Telerik team
 answered on 18 Feb 2014
1 answer
158 views
Sorry if this has been discussed, I searched but did not find anything.  I have the below code in the code behind of my View, but would like to move it to the viewmodel and use binding to set it.  I know how to set everything up except for binding the DistinctFilter.  Is this possible?  If you need more information, I'll try to provide as much as I can.

private void ChartSelectionBehavior_SelectionChanged(object sender, Telerik.Windows.Controls.ChartView.ChartSelectionChangedEventArgs e)
        {
            grid.FilterDescriptors.SuspendNotifications();
 
            IColumnFilterDescriptor filter = grid.Columns["Status"].ColumnFilterDescriptor;
            filter.SuspendNotifications();
 
            foreach (var point in e.AddedPoints)
            {
                var value = ((PieChartData)point.DataItem).Label;
                filter.DistinctFilter.AddDistinctValue(value);
            }
 
            foreach (var point in e.RemovedPoints)
            {
                var value = ((PieChartData)point.DataItem).Label;
                filter.DistinctFilter.RemoveDistinctValue(value);
            }
 
            filter.ResumeNotifications();
            grid.FilterDescriptors.ResumeNotifications();
 
        }
Dimitrina
Telerik team
 answered on 18 Feb 2014
13 answers
192 views
Hey, I'm currently having an issue with grouping not working with a column converter, when bound to a VirtualQueryableCollectionView.
When grouping a column with a converter in its databinding (by dragging the column header over the grouping panel), the values displayed are not the converted values, but the underlying values on my model. What is odd, is that the converted values are displayed in the grid, and all the column filtering (with the distinct value filters) are all working as expected. That is, they are having their values run through a converter.

Here is a sample of our code:

Xaml:
<telerik:RadGridView ItemsSource="{Binding QueryableRiskEvents}" AutoGenerateColumns="False" IsReadOnly="True" ">
    <telerik:RadGridView.Columns>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding risk_id}" Header="ID"/>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding equipment_code}" Header="Equipment"/>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding risk_description}" Header="Description"/>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding start_date}" Header="Start"/>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding end_date}" Header="End"/>
        <telerik:GridViewDataColumn DataMemberBinding="{Binding risk_status, Converter={StaticResource StatIntToString}}" Header="Status"/>

C# (on our viewmodel):
public VirtualQueryableCollectionView QueryableRiskEvents
{
            get
            {
                var query = Repository.Entities.RiskEvents.OrderBy(r => r.start_date);
                _queryableRiskEvents = new VirtualQueryableCollectionView(query, typeof(RiskEvent))
                {
                    LoadSize = 10,
                };
                return _queryableRiskEvents;
            }
        }

C# (the converter):
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
            return "hello";
        }
 
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
            return value;
    }


With this simplified example, grouping by our Status column shows the underlying integers, rather than multiple "hello" strings. 

I have tried just binding the ItemSource to the IQueryable directly (without wrapping it in the VirtualQueryableCollectionView), and the same problem occurs. However, the grouping works perfectly if bound to an IEnumerable source (but fetches all db results at once).
 
I'd greatly appreciate any tips on how we can get the expected behaviour working (as it already does with the filtering).

Dimitrina
Telerik team
 answered on 18 Feb 2014
8 answers
393 views
Hi,

I would like to know how I can hide the delete (X) button in each appointment spot?

Thank's
Alain
Kalin
Telerik team
 answered on 18 Feb 2014
1 answer
312 views
I have RadPaneGroup on the right side of my application window. The PaneGroup contains several RadPanes, that are not pinned by default.

When the user clicks one of these panes the pane appears instantly without enervating animation. Then the user pins the pane. When he unpins it again, the pane slides back to its PaneGroup and "disappears".

The problem is, that when sliding back, there is some animation I cannot impede. I don't want any animation when inning and unpinning my panes, because this lets the application appear slow to the user.

I tried:

<telerik:RadPane Title="Editor" IsPinned="False" CanUserClose="False" Name="EditorPane" telerikAnimation:AnimationManager.IsAnimationEnabled="False">
    <controls:Editor x:Name="Editor"/>
</telerik:RadPane>

But still there is some animation when unpinning the pane.

How get I rid of the animation???
Masha
Telerik team
 answered on 18 Feb 2014
1 answer
243 views
I am using an MVVM pattern for binding my UI. I am using ICommand's to attach the handlers. I created a "Select All" checkbox in the Header of a GridViewDataColumn, but every time I pass the commandParameter of the SelectAll checkbox itself, it comes up null. 

However, it worked perfectly if I take the EXACT SAME checkbox and move it EITHER completely outside of the RadGridView, or even into a CellTemplate. It appears the binding is occurring before the Header has been created. Or am I just creating a "Select All" completely wrong?

XAML:
<UserControl>
    <UserControl.Resources>
        <c:InfoBaseViewModel x:Key="InfoBaseViewModel2"/>
    </UserControl.Resources>
    <DockPanel Name="InfoDockPanel" DataContext="{StaticResource InfoBaseViewModel2}">
        <telerik:RadGridView x:Name="grdInfo" AutoGenerateColumns="False" IsReadOnly="True" ItemsSource="{Binding Path=InfoList}" ShowGroupPanel="False">
  
                <telerik:GridViewDataColumn>
                    <telerik:GridViewDataColumn.Header>
  
                        <CheckBox Name="chkAll" CommandParameter="{Binding ElementName=chkAll}" Command="{Binding AllCheckedCommand,Source={StaticResource InfoBaseViewModel2}}" ></CheckBox>
  
                    </telerik:GridViewDataColumn.Header>
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>                          
                            <CheckBox IsChecked="{Binding Path=IsItemSelected, Mode=TwoWay}"></CheckBox>
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding FullName}" Header="{Binding Path=ApplicationStrings.FullNameLabel, Source={StaticResource ResourceWrapper}}"></telerik:GridViewDataColumn>
                </telerik:GridViewDataColumn>
  
        </telerik:RadGridView>
    </DockPanel>
</UserControl>

ViewModel command handler:
public ICommand AllCheckedCommand
{
    get { return _allItemsChecked ?? (_allItemsChecked = new RelayCommand(AllCheckedHandler, null)); }
}
 
public void AllCheckedHandler(object sender)
{
    // Always gets to here...
    var chkAll = sender as System.Windows.Controls.CheckBox;
     
    if (chkAll == null)
    {
        // ...but always fails
        Logger.Error("Error binding the 'Select All' checkbox.");
    }
    else
    {
        foreach (var item in InfoList)
        {
            item.IsItemSelected = (bool)chkAll.IsChecked;
        }
        base.OnPropertyChanged("InfoList");
    }
}

Yoan
Telerik team
 answered on 18 Feb 2014
3 answers
179 views
Hello.
How I can set my color for shape in RadDiagramToolbox? I want shapes to be drawn in white in RadDiagramToolbox.
Zarko
Telerik team
 answered on 17 Feb 2014
4 answers
212 views
Hi,

I'm trying to create a window layout with a RadTabControl where the user can dynamically add RadTabItems. This is done MVVM style with a data bound itemssource inside the RadTabControl. Inside the bound items collection are viewmodels which are resolved to views by datatemplates. The views only contain a RadDocking with RadSplitContainer and RadPaneGroup. Now, the user can dynamically add more views of different types which are initialized as ToolWindows. These ToolWindows are created by the RadDocking which is currently selected in the RadTabControl. This makes the ToolWindow somehow depending on the specific RadDocking.

Problem: If the user opens a ToolWindow, changes the selected tab and then wants to dock the ToolWindow into the now selected RadDocking (which is not the parent of the ToolWindow), the ToolWindow docks into the parent RadDocking in the hidden tab. This only works because the RadTabControl has set "IsContentPreserved" to "true". If set to "false", the ToolWindows hide if the parent RadDocking is in a non-selected tabitem.

Workaround attempt: everytime the selected tabitem changes, I can iterate through all ToolWindows, remove the nested panes from their parents and add them to the RadDocking in the now selected tabitem. But the current docking state of the pane is lost in this process. It is docked into the RadDocking and not inside a ToolWindow anymore. I can make the pane float again and even restore the position and size of the ToolWindow that was previously hosting the pane. But...

Two problems with the workaround:
1) The ToolWindows flicker when changing the selected tab. It looks like it is closing and immediately reopening. Is there a better way to move a ToolWindow from one RadDocking to another?
2) What if I have multiple RadPanes docked and tabbed into one ToolWindow in certain way? I would have to move the RadSplitContainer from one RadDocking to another to preserve the complete layout. But RadSplitContainer is not offering a method like "RemoveFromParent"... I'm a little bit stuck here.

The most comfortable solution would be to change the parent of the ToolWindow to another RadDocking, but it doesn't look like this is possible in the current Telerik WPF release...

Thanks for any help in advance!

Regards,
Marcel
Paul
Top achievements
Rank 1
 answered on 17 Feb 2014
3 answers
342 views
Hello,
I was wondering if it is possible to set the RowDetailsVisibilityMode to Collapsed, but then in code set certain rows to show the details. I don't want the user to be able to show the details, but I may at times choose, for instance, row 2 and row 4 to show the details. Is this possible?

Thanks,
Scott
Hristo
Telerik team
 answered on 17 Feb 2014
1 answer
76 views
I have a grid with 2 subgrids. This hierachy is defined in the xaml with the ChildTableDefinitions property. The child grids have
grd.MaxHeight = double.PositiveInfinity;
in order to avoid a clutter of scrollbars. Also row virtualization has been turned off for as well the main grid as the child grids.

Now I'm implementing a refresh operation. During this, I want to reselect the item that was selected before the refresh was started (there is only one item selected in all these grids). I do this by expanding the appropriate rows until I reach the grid with the item to be selected. Then I set that grid's SelectedItem property.

So far so good. Well... For obvious reasons I want to scroll the selected item back into view. When the selected row was in the main grid, I can just perform a
grd.ScrollIntoView(objSel);
with objSel being a refreshed object. But when I do this for a childgrid, nothing happens. I presume because the child grid doesn't have a scrollbar and as far as this grid is concerned, the selected row is in view.

Also when I try
grdMain.ScrollIntoView(objSel);
nothing happens. I guess because objSel is not in the ItemsSource of the main grid (I didn't expect it to work, but I had to try). Also
grd.BringIntoView();
did not work out.

So I wonder what is a correct approach to scroll the selected item of a childgrid into view.

Thanks in advance,
   Herre
Yoan
Telerik team
 answered on 17 Feb 2014
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
DataPager
PersistenceFramework
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
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?