Telerik Forums
UI for WPF Forum
0 answers
157 views
HI

I m new to Telerik WPF, i m having a problem with child binding, can u plz help me out.

code:
<telerik:RadGridView x:Name="AnalysisListGridView" Grid.Column="3" Grid.Row="2"  Width="665" Height="405" RowLoaded="RadGridView1_RowLoaded"
                                 AutoGenerateColumns="False" IsReadOnly="True" VerticalAlignment="Center" HorizontalContentAlignment="Left"
                                 MinColumnWidth="20" GridLinesVisibility="Horizontal" RowHeight="33" CanUserSortColumns="True" CanUserResizeColumns="False"
                                 CanUserReorderColumns="False" CanUserFreezeColumns="False" FontSize="12" ScrollViewer.CanContentScroll="true"
                                 FontFamily="Arial" Padding="0,0,0,0" BorderBrush="#FFCBD7E3" Foreground="#FF707070" Background="#FFFFFFFF"
                                 HorizontalGridLinesBrush="#FFEEEEEE" SelectionUnit="FullRow" SelectionMode="Single" ShowGroupPanel="False"
                                 RowIndicatorVisibility="Collapsed" GroupPanelForeground="Black" AlternateRowBackground="#FFF4F4F4" telerik:Theming.Theme="Windows7"
                                 telerik:StyleManager.Theme="Windows7" BorderThickness="1" Cursor="Hand" LoadingRowDetails="AnalysisListGridView_LoadingRowDetails">
                <telerik:RadGridView.HeaderRowStyle>
                    <Style TargetType="telerik:GridViewHeaderRow">
                        <Setter Property="Background">
                            <Setter.Value>
                                <LinearGradientBrush EndPoint="0.5,0" StartPoint="0.5,1">
                                    <GradientStop Color="#FFcfd7db"/>
                                    <GradientStop Color="#FFFFFFFF" Offset="1"/>
                                </LinearGradientBrush>
                            </Setter.Value>
                        </Setter>
                    </Style>
                </telerik:RadGridView.HeaderRowStyle>
                <telerik:RadGridView.ChildTableDefinitions>
                    <telerik:GridViewTableDefinition/>
                </telerik:RadGridView.ChildTableDefinitions>
 
            </telerik:RadGridView>
private void GetHistoryInfo()
{
    this.AnalysisListGridView.ItemsSource = null;
    this.AnalysisListGridView.ItemsSource = ROISync.GetOfflineAnalysisHistory(App.LoggedInUser).ListROIAnalysis.OrderByDescending(an => an.AnalysisLastUpdatedDateTime);
}
 
void RadGridView1_RowLoaded(object sender, RowLoadedEventArgs e)
{
    GridViewTableDefinition definition = new GridViewTableDefinition();
    GridViewRow row = e.Row as GridViewRow;
    ROIAnalysisDataModel analysis = e.DataElement as ROIAnalysisDataModel;
 
    if (row != null && analysis != null)
    {
        row.IsExpandable = this.HasSubordinates(analysis);
    }
}
 
private bool HasSubordinates(ROIAnalysisDataModel analysis)
{
    IEnumerable<ROIAnalysisDataModel> childDataSource = ROISync.GetOfflineAnalysisHistory(App.LoggedInUser).ListROIAnalysis.Where(a => a.ParentID != 0).OrderByDescending(an => an.AnalysisLastUpdatedDateTime);
    return (from Anlys in childDataSource where Anlys.ParentID == analysis.AnalysisID select Anlys).Any();
}
 
void AnalysisListGridView_LoadingRowDetails(object sender, GridViewRowDetailsEventArgs e)
{
 
    GridViewTableDefinition definition = new GridViewTableDefinition();
    GridViewDataControl dataControl = (GridViewDataControl)sender;
    if (dataControl.ParentRow != null && dataControl.ChildTableDefinitions.Count == 0)
    {
        int ParentID = Convert.ToInt32(((ROIDataModels.ROIAnalysisDataModel)(((Telerik.Windows.Controls.RadRowItem)(dataControl.ParentRow)).Item)).AnalysisID);
        foreach (ROIDataModels.ROIAnalysisDataModel folder in ROISync.GetOfflineAnalysisHistory(App.LoggedInUser).ListROIAnalysis)
        {
            if (folder.FileType.ToLower() == "folder" || folder.ParentID == ParentID)
            {
                definition.DataSource = null;
                definition.DataSource = ROISync.GetOfflineAnalysisHistory(App.LoggedInUser).ListROIAnalysis.Where(a => a.ParentID == folder.ParentID).OrderByDescending(an => an.AnalysisLastUpdatedDateTime);
                dataControl.ChildTableDefinitions.Add(definition);
            }
        }
    }
}
 
private void AnalysisListGridView_DataLoading(object sender, Telerik.Windows.Controls.GridView.GridViewDataLoadingEventArgs e)
{
    GridViewDataControl dataControl = (GridViewDataControl)sender;
    if (dataControl.ParentRow != null)
    {
        dataControl.ShowGroupPanel = false;
        dataControl.AutoGenerateColumns = false;
        dataControl.CanUserFreezeColumns = false;
        dataControl.IsReadOnly = true;
        dataControl.SelectionMode = System.Windows.Controls.SelectionMode.Extended;
        dataControl.IsFilteringAllowed = false;
        dataControl.ShowInsertRow = false;
        dataControl.RowIndicatorVisibility = Visibility.Collapsed;
        dataControl.ChildTableDefinitions.Clear();
        dataControl.Margin = new Thickness(0, 0, 0, 0);
        dataControl.EnableRowVirtualization = true;
        dataControl.MaxHeight = 100;
        ScrollViewer.SetVerticalScrollBarVisibility(dataControl, ScrollBarVisibility.Auto);
 
        int ParentID = Convert.ToInt32(((ROIDataModels.ROIAnalysisDataModel)(((Telerik.Windows.Controls.RadRowItem)(dataControl.ParentRow)).Item)).AnalysisID);
        GridViewTableDefinition definition = new GridViewTableDefinition();
        definition.DataSource = null;
        definition.DataSource = ROISync.GetOfflineAnalysisHistory(App.LoggedInUser).ListROIAnalysis.Where(a => a.ParentID == ParentID).OrderByDescending(an => an.AnalysisLastUpdatedDateTime);
        //dataControl.ChildTableDefinitions.Clear();
        dataControl.ChildTableDefinitions.Add(definition);
    }
}


note:
Is there any folder structure options available there in wpf,
screenshot attached is the mockup for Folder Structure.



Thanks
Zeno J S
Zeno
Top achievements
Rank 1
 asked on 13 Aug 2011
2 answers
155 views
I'm attempting to conform to the MVVM paradigm for my project. I'm already binding to a LocationCollection, which I use to plot points for a polygon on the map. This is working fine using the following:

<telerik:InformationLayer Name="informationLayer">
    <telerik:MapPolygon Points="{Binding MyPolygon}" />
</telerik:InformationLayer>


I'd like to add additional information in the form of images that are dragged and dropped onto the map. I have no problem manually adding images using the following in the code behind:

RadMap map = (RadMap)e.Options.Destination;
Location dropCursorLocation = Location.GetCoordinates(map, e.Options.RelativeDragPoint);
Image img = new Image { Source = new BitmapImage(new Uri(@"..\Resources\MyImage.png", UriKind.Relative)) };
 
MapLayer.SetLocation(img, dropCursorLocation);
informationLayer.Items.Add(img);

I'm fine with everything in the view model up until I add the image to the information layer. The MapPolygon typed works well for my polygon, but what should I use for my images? Should I add another type under the InformationLayer section? If so, which type should I use?
Sean
Top achievements
Rank 1
 answered on 12 Aug 2011
1 answer
120 views
The example in the documentation for Drag and Drop in RadTreeView indicates that setting IsDragDropEnabled="True" will allow elements to be dragged both into other elements and before/after said elements. However, in my experience I cannot get elements to successfully drag before/after other elements even with the very simple example code (pasted below). What am I missing?

        <telerik:RadTreeView x:Name="radTreeView" Grid.Row="2" IsDragDropEnabled="True" IsDropPreviewLineEnabled="True">
            <telerik:RadTreeViewItem Header="Sport Categories">
                <telerik:RadTreeViewItem Header="Football">
                    <telerik:RadTreeViewItem Header="Futsal"/>
                    <telerik:RadTreeViewItem Header="Soccer"/>
                </telerik:RadTreeViewItem>
                <telerik:RadTreeViewItem Header="Tennis">
                    <telerik:RadTreeViewItem Header="Table Tennis"/>
                </telerik:RadTreeViewItem>
                <telerik:RadTreeViewItem Header="Cycling">
                    <telerik:RadTreeViewItem Header="Road Cycling"/>
                    <telerik:RadTreeViewItem Header="Indoor Cycling"/>
                    <telerik:RadTreeViewItem Header="Mountain Bike"/>
                </telerik:RadTreeViewItem>
            </telerik:RadTreeViewItem>
        </telerik:RadTreeView>

Tina Stancheva
Telerik team
 answered on 12 Aug 2011
4 answers
360 views
I've got a form with a RadSplitButton on it.  I've set the control's DropDownContent to a RadContextMenu.  When I click on the DropDown indicator, the context menu shows.  However, when you click on an item in the context menu, the context menu does not close.

How do I make the context menu close once an item in the menu has been clicked?  There doesn't seem to be a Close method in the RadContextMenu class, though there are Closing & Closed events.

Also, is there a way that I can change the width of the Drop Down Indicator?  There doesn't seem to be a property for it.  I'm working on a WPF application with touch screen support that will run in a police car, so everything has to be large for a cop to make effective use while driving.  The buttons are rather large & the drop down indicator is down-right puny & easily missed at its current size.

Tony
Viktor Tsvetkov
Telerik team
 answered on 12 Aug 2011
2 answers
183 views
Hi,
when I am using an observable collection of the following class as ItemsSource for the datagrid I get an exception when  I add a new Row (via UI, ShowInsertRow is enabled) and the row is commited.

ArgumentOutOfRangeException: "Specified argument was out of the range of valid values. Parameter name: index".
Source: "Telerik.Windows.Data"
Stacktrace: "bei Telerik.Windows.Data.QueryableCollectionView.GetItemAt(Int32 index) in c:\TB\102\WPF_Scrum\Release_WPF_40\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:Zeile 1766."
File Version of Telerik.Windows.Controls.GridView.dll is 2011.2.712.40.

This happens only when binding a list of ParameterView. ViewModelBase just implements INotifyPropertyChanged.
public class ParameterView : ViewModelBase<ParameterView>
{
    private string _name;
    public string Name
    {
        get { return _name; }
        set { _name = value; Notify(x => x.Name);}
    }
  
    private string _value;
    public string Value
    {
        get { return _value; }
        set { _value = value; Notify(x => x.Value); }
    }
  
    public ParameterView() : this(string.Empty,string.Empty)
    {
    }
  
    public ParameterView(string name, string value)
    {
        Name = name;
        Value = value;
    }
  
    public override string ToString()
    {
        return string.Format("Name: {0}, Value: {1}", _name, _value);
    }
  
    public bool Equals(ParameterView other)
    {
        if (ReferenceEquals(null, other)) return false;
        if (ReferenceEquals(this, other)) return true;
        return Equals(other._name, _name);
    }
  
    public override bool Equals(object obj)
    {
        if (ReferenceEquals(null, obj)) return false;
        if (ReferenceEquals(this, obj)) return true;
        if (obj.GetType() != typeof(ParameterView)) return false;
        return Equals((ParameterView)obj);
    }
  
    public override int GetHashCode()
    {
        unchecked
        {
            return ((_name != null ? _name.GetHashCode() : 0) * 397) ^ (_value != null ? _value.GetHashCode() : 0);
        }
    }
}
Sebastian
Top achievements
Rank 1
 answered on 12 Aug 2011
3 answers
53 views
Hi Support,

I am looking out for search option with suggestion. Please see the exmaple here  As for example if you type F in  the search box, it should suggest you all possible states and country starting with "F" .

Please provide some sample code.

Thanks for the help,
Vivek.
Andrey
Telerik team
 answered on 12 Aug 2011
1 answer
114 views
I have a tileview bound to a collection of custom objects.  I would like to make sure that the tileview scrolls to a given item based on a property of the underlying object.  Can you point me in the right direction?
Tina Stancheva
Telerik team
 answered on 12 Aug 2011
3 answers
151 views
Can I hide Saturday's and Sunday's and only show M-F? In all views (Maybe not month view)?
Rod
Yana
Telerik team
 answered on 12 Aug 2011
5 answers
507 views
Hi,

i am having a (maybe?) simple question. In our framework, we have a custom control derivation for each telerik control we use. This works pretty good, but sometimes i have problems to set the theme of the nested controls within such a derivation. One of these problematic cases is the ComboBox. The Vista theme is assigned via Generic.xaml:

<Style TargetType="{x:Type data:ComboBox}" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:VistaTheme, ElementType=telerik:RadComboBox}}">
        <Setter Property="Height" Value="23"></Setter>
        <Setter Property="ItemContainerStyle">
            <Setter.Value>
                <Style TargetType="{x:Type telerik:RadComboBoxItem}" BasedOn="{StaticResource {telerik:ThemeResourceKey ThemeType=telerik:VistaTheme, ElementType=telerik:RadComboBoxItem}}">
                </Style>
            </Setter.Value>
        </Setter>
    </Style>

In the code file, we force the usage of the new theme:

Shared Sub New()
 
    ' Connect new template
    DefaultStyleKeyProperty.OverrideMetadata(GetType(ComboBox), New FrameworkPropertyMetadata(GetType(ComboBox)))
 
End Sub
Protected Overrides Sub OnInitialized(ByVal e As System.EventArgs)
 
    ' Call base class method
    MyBase.OnInitialized(e)
 
    ' Ensure template
    Me.DefaultStyleKey = GetType(ComboBox)
 
End Sub

This works good. The ComboBox and the items are using the Vista theme. But now, i want the Box to be editable. The TextBox, the Button and the ScrollViewer are still using the default theme. How can i archive, that the named controls use the Vista theme? I want to define that in the Generic.xaml.

I hope you can help me. Styling and templating are not my favourite tasks ;-)

Greeting from germany, Carsten
Konstantina
Telerik team
 answered on 12 Aug 2011
1 answer
140 views
When going into design mode of my ApplicationResource.xaml file, I see the following error come up. Everything seems to compile fine but my outlinging expansion and intellisense no longer works in the xaml file. Wondering if this has to do with the load error. Here is the stack trace...

System.IO.FileLoadException

Could not load file or assembly 'Telerik.Windows.Controls, Version=2011.2.808.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) at System.Reflection.Assembly.Load(AssemblyName assemblyRef) at MS.Internal.Package.VSIsolationProviderService.RemoteReferenceProxy.VsReflectionResolver.GetRuntimeAssembly(Assembly reflectionAssembly) at Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.CachingReflectionResolver.GetRuntimeAssembly(Assembly reflectionAssembly) at Microsoft.Windows.Design.Metadata.ReflectionMetadataContext.Microsoft.Windows.Design.Metadata.IReflectionResolver.GetRuntimeAssembly(Assembly reflectionAssembly) at MS.Internal.Metadata.ClrAssembly.GetRuntimeMetadata(Object reflectionMetadata) at Microsoft.Windows.Design.Metadata.AttributeTableContainer.<MergeAttributesIterator>d__c.MoveNext() at Microsoft.Windows.Design.Metadata.AttributeTableContainer.GetAttributes(Assembly assembly, Type attributeType, Func`2 reflectionMapper) at MS.Internal.Metadata.ClrAssembly.GetAttributes(ITypeMetadata attributeType) at MS.Internal.Design.Metadata.Xaml.XamlAssembly.get_XmlNamespaceCompatibilityMappings() at Microsoft.Windows.Design.Metadata.Xaml.XamlExtensionImplementations.GetXmlNamespaceCompatibilityMappings(IAssemblyMetadata sourceAssembly) at Microsoft.Windows.Design.Metadata.Xaml.XamlExtensions.GetXmlNamespaceCompatibilityMappings(IAssemblyMetadata source) at MS.Internal.Design.Metadata.ReflectionProjectNode.BuildSubsumption() at MS.Internal.Design.Metadata.ReflectionProjectNode.SubsumingNamespace(Identifier identifier) at MS.Internal.Design.Markup.XmlElement.BuildScope(PrefixScope parentScope, IParseContext context) at MS.Internal.Design.Markup.XmlElement.ConvertToXaml(XamlElement parent, PrefixScope parentScope, IParseContext context, IMarkupSourceProvider provider, Boolean visitCodeModel) at MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.FullParse(Boolean convertToXamlWithErrors) at MS.Internal.Design.DocumentModel.DocumentTrees.Markup.XamlSourceDocument.get_RootItem() at Microsoft.Windows.Design.DocumentModel.Trees.ModifiableDocumentTree.get_ModifiableRootItem() at Microsoft.Windows.Design.DocumentModel.MarkupDocumentManagerBase.get_LoadState() at MS.Internal.Host.PersistenceSubsystem.Load() at MS.Internal.Host.Designer.Load() at MS.Internal.Designer.VSDesigner.Load() at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.Load() at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedDesignerFactory.Load(IsolatedView view) at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view) at MS.Internal.Host.Isolation.IsolatedDesigner.BootstrapProxy.LoadDesigner(IsolatedDesignerFactory factory, IsolatedView view) at MS.Internal.Host.Isolation.IsolatedDesigner.Load() at MS.Internal.Designer.DesignerPane.LoadDesignerView(Boolean isReload)

System.NotSupportedException

An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.


Vanya Pavlova
Telerik team
 answered on 12 Aug 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
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?