Telerik Forums
UI for WPF Forum
5 answers
296 views
I am using a GridView in a master - detail, MVVM, Prism scenario.  When I navigate to the master, I want to set the selected item to an item whose ID is passed in during navigation.  The difficulty I am having is that appears that the Selected Item is being set in the modelview before the GridView data loading is complete.  In debug, I can see that the Selected Item is getting set properly and PropertyChanged is raised for the operation.  Subsequent to this, the Selected Item is getting reset to a different value from the GridView via the TwoWay binding, I'm guessing after data loading has been completed by the GridView.  How can I ensure that the selection being made from within the viewmodel does not get overriden by the loading operation of the GridView?  Here are some code snippets:
public void OnNavigatedTo(NavigationContext navigationContext)
{
    // Called to initialize views during navigation.
 
    // Is this for AgentView?
    if (navigationContext.Uri.ToString().Contains("AgentsView"))
    {
        // The ID of the item to be displayed is passed as a navigation parameter.
        // ToInt32 can throw FormatException or OverflowException.
        try
        {
            int id = Convert.ToInt32(navigationContext.Parameters["PersonID"]);
            if (id == 0) return;
 
            // Retrieve the specified item using the data service.
            var agent = new DAL.Agent();
            _agentsDataService.GetSelectedAgent(id, GetAgentsCallback);
         }
        catch (FormatException e)
        {
            //Console.WriteLine("Input string is not a sequence of digits.");
            //return CurrentItem == null ? false : CurrentItem.Id.Equals(id);
        }
    }
}
 
private void GetAgentsCallback(DAL.Agent agent)
{
    _navigatedToAgent = agent;
    if (_navigatedToAgent != null)
    {
        SelectedAgent = _navigatedToAgent;
    }
}
 
public DAL.Agent SelectedAgent
{
    get { return _selectedAgent; }
    set
    {
        if (_selectedAgent == value) return;
        _selectedAgent = value;
        RaisePropertyChanged(() => SelectedAgent);
        _eventAggregator.GetEvent<AgentSelectedEvent>().Publish(_selectedAgent);
    }
}

SelectedItem="{Binding SelectedAgent, Mode=TwoWay}"
Dimitrina
Telerik team
 answered on 30 Nov 2012
4 answers
1.1K+ views
Hi,

I am creating a generic grid solution based on the Telerik grid as a prototype to test the suitability of the Telerik components.

Our data layer can not send us typed objects. Instead it sends an object with an array of field names and an array of values.

Arrays
My first approach was to use a binding expression referencing the index to display i.e:

DataMemberBinding="{Binding Path=Values[0]}"

The grid does retrieve the values using this expression, but grouping, sorting and filtering are missing.

Dynamic object
Since this didn't work I thought I could trick the grid into thinking the model was strongly typed using a dynamic object that returned values based on the binding name:

public override bool TryGetMember(GetMemberBinder binder, out object result)
{
    if (!this.AllFields.Contains(binder.Name))
    {
        return base.TryGetMember(binder, out result);
    }
 
    result = this.Values[this.AllFields.IndexOf(binder.Name)];
    return true;
}
This fixed grouping and sorting however filtering is still not working

I've have a simplified test project that demonstrates my findings, but the forum won't allow me to attach it. Any help resolving this issue would be most welcome.
Edward Wilde
Top achievements
Rank 1
 answered on 30 Nov 2012
1 answer
154 views
Hello!

As it is currently designed in the telerik no mater what I do I always get the limits labels over Scale's path border.
But I would like to have all the labels inside the scale's bar as in attached image...

( <Gauges:LabelProperties Location="OverCenter" /> )

How is that possible?

Thank you
Andrey
Telerik team
 answered on 30 Nov 2012
2 answers
181 views
Hello,

cant start my applikation with new internal build 1126

An exception of type 'System.ArgumentNullException' occurred in Telerik.Windows.Controls.dll 

Additional information: Value cannot be null.

>   Telerik.Windows.Controls.dll!Telerik.Windows.DragDrop.DragDropManager.CheckNotNull(System.Windows.DependencyObject element, System.Delegate handler) Line 1168  C#
    Telerik.Windows.Controls.dll!Telerik.Windows.DragDrop.DragDropManager.RemoveDragOverHandler(System.Windows.DependencyObject element, Telerik.Windows.DragDrop.DragEventHandler handler) Line 789    C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.FrozenColumnsSplitter.UnSubscribeFromMouseEvents() Line 255 C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.FrozenColumnsSplitter.FrozenColumnsSplitter_IsEnabledChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e) Line 136   C#
    [External Code]
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewRowItem.MeasureOverride(System.Windows.Size availableSize) Line 197 + 0x25 bytes    C#
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewHeaderRow.MeasureOverride(System.Windows.Size availableSize) Line 215 + 0x2c bytes  C#
    [External Code]
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewScrollViewer.MeasureOverride(System.Windows.Size constraint) Line 173 + 0x25 bytes  C#
    [External Code]
    Telerik.Windows.Controls.GridView.dll!Telerik.Windows.Controls.GridView.GridViewDataControl.MeasureOverride(System.Windows.Size availableSize) Line 6587 + 0x2b bytes   C#
    [External Code]
    Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.InternalWindow.WindowWithNoChromeWindowHost.WindowHostWindow.MeasureOverride(System.Windows.Size availableSize) Line 341 + 0x28 bytes  C#
    [External Code]
    Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.InternalWindow.WindowWithNoChromeWindowHost.Open(bool isModal) Line 40 C#
    Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.WindowBase.ShowWindow(bool isModal) Line 864   C#
    Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.RadWindow.Show() Line 386  C#
    IZTMediaLibrary.dll!IZTMediaLibrary.Starter.Run() Line 27   C#
    IZT Signal Suite Database.exe!wWinMain(HINSTANCE__* hInstance, HINSTANCE__* hPrevInstance, wchar_t* lpCmdLine, int nCmdShow) Line 75    C++
    IZT Signal Suite Database.exe!__tmainCRTStartup()  Line 547 + 0x1c bytes    C
    [External Code]
    mscoreei.dll!70d655ab()    
    [Frames below may be incorrect and/or missing, no symbols loaded for mscoreei.dll] 
    mscoree.dll!70dd7f16() 
    mscoree.dll!70dd4de3() 
    kernel32.dll!764033aa()    
    ntdll.dll!77829ef2()   
    ntdll.dll!77829ec5()   
steven littleford
Top achievements
Rank 1
 answered on 30 Nov 2012
1 answer
270 views
hi all, can u help me to understand what's wrong in this style?

PocVertex is a ViewModel object representing the diagram Node.

<Style x:Key="PocNodeStyle" TargetType="telerik:RadDiagramShape">
        <Setter Property="Position" Value="{Binding Position, Mode=TwoWay}" />
        <Setter Property="Width" Value="200" />
        <Setter Property="Height" Value="50" />
        <Setter Property="IsConnectorsManipulationEnabled" Value="False" />
        <Setter Property="IsRotationEnabled" Value="False" />
        <Setter Property="Template">
            <Setter.Value>
                <DataTemplate DataType="{x:Type local:PocVertex}">
                    <ContentControl>
                        <Border Name="bd" Background="#FFE3E3E3"
                                BorderBrush="{Binding Path=.,Converter={StaticResource nodeBorderColorConverter}}"
                                BorderThickness="5,3,5,3"
                                CornerRadius="10,10,10,10"
                                Padding="10,5,10,5">
                            <Border.ContextMenu>
                                <ContextMenu    >
                                    <MenuItem x:Name="miCollega"                              Header="collega con" />
                                    <MenuItem x:Name="miCollega_Opzione"                      Header="collega con opzione" />
                                    <MenuItem x:Name="miElimina"                              Header="elimina" />
                                    <MenuItem x:Name="miElimina_Collegamenti"                 Header="elimina collegamenti" />
                                    <MenuItem x:Name="miRadice"                               Header="Imposta come radice" />
                                    <MenuItem x:Name="miDuplica"                              Header="duplica nodo" />
                                    <MenuItem x:Name="miCopiaNodo"                            Header="copia nodo" />
                                    <MenuItem x:Name="miEmail"                                Header="invia email"           />
                                    <!--ItemsSource="{Binding Source={x:Static s:Settings.Default}, Path=Emails, Mode=TwoWay}"-->
                                    <MenuItem x:Name="miNuovo"                                    Header="nuovo nodo"  >
                                        <MenuItem x:Name="miNuovo_Diretto"                        Header="diretto" />
                                        <MenuItem x:Name="miNuovo_Opzione"                        Header="opzione" />
                                    </MenuItem>
                                    <MenuItem x:Name="miIsolaNodo"                                Header="isola nodo" />
                                </ContextMenu>
                            </Border.ContextMenu>
                            <TextBlock Name="txtCaption" Text="{Binding Caption}"  ToolTip="{Binding Text}"/>
                        </Border>
                    </ContentControl>
                    <DataTemplate.Triggers>
                        <DataTrigger Binding="{Binding Path=IsRoot}" Value="True">
                            <DataTrigger.Setters>
                                <Setter Property="TextDecorations" Value="Underline" TargetName="txtCaption" />
                            </DataTrigger.Setters>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Path=IsHighlighted}" Value="True">
                            <DataTrigger.Setters>
                                <Setter Property="BorderBrush" Value="Red" TargetName="bd" />
                            </DataTrigger.Setters>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding Path=IsSelected}" Value="True">
                            <DataTrigger.Setters>
                                <Setter Property="Background" Value="Yellow" TargetName="bd" />
                            </DataTrigger.Setters>
                        </DataTrigger>
                    </DataTemplate.Triggers>
                </DataTemplate>
            </Setter.Value>
        </Setter>
    </Style>
Tina Stancheva
Telerik team
 answered on 30 Nov 2012
1 answer
104 views
Hi,

I have used a candlestick and a barchart in same page. When I changed the zooming parameters and scrolling the scrollbar, the candlestick's DateTimeCategoricalAxis display has some problem, please see the picture.
Peshito
Telerik team
 answered on 30 Nov 2012
8 answers
390 views
Hi,

I would like my application to save the grid state (sort, column order, filters, etc) and then when restarted I would like to re-apply these settings.

I started playing around with this idea only to find the SortDescription and CompositeFilterDescription are not Serializable.  Can we please make these serializable in a future release?  Even better can we add the methods:
RadGridView.SaveGridState(string filename)
RadGridView.LoadGridState(string filename)

Thanks

Guido Tapia
Maya
Telerik team
 answered on 30 Nov 2012
4 answers
138 views
Hi,

I'm having trouble changing the dictionary to en-GB when the RadRichTextBox control is hosted in a RadWindow rather than a standard window.
It will be easier to see some coding examples of my problem.

Initial Loading Code:
public Editor2(int _userID)
{
    InitializeComponent();
 
    //Set Language
    this.Language = XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag);
 
    //Make RadWindow a normal window (to show taskbar icon etc)
    RadWindowHelper2 windowHelper = new RadWindowHelper2();
    windowHelper.TaskBarDisplayed += new EventHandler(windowHelper_TaskBarDisplayed);
    windowHelper.ShowWindowInTaskBar();
 
    //Set Document Styles
    RadDocumentStyles.AddStylesToDocumentRepository(this.radRichTextBox1.Document);
 
    //Set dictionary to English GB
    Stream stream = Application.GetResourceStream(new Uri("en-GB.tdf", UriKind.RelativeOrAbsolute)).Stream;
    this.LoadDictionary(stream);
}


Notice that I'm using a class called RadWindowHelper2 and a method windowHelper_TraskBarDisplayed(). I obtained this code somewhere in these forums so that a taskbar item is displayed.
At the end of the initial code I then call LoadDictionary() to change the dictionary to en-GB.


RadWindowsHelper2 class
public class RadWindowHelper2
{
    public event EventHandler TaskBarDisplayed;
 
    public void ShowWindowInTaskBar()
    {
        if (this.TaskBarDisplayed != null)
        {
            this.TaskBarDisplayed(this, new EventArgs());
        }
    }
}

windowHelper_TaskBarDisplayed()
void windowHelper_TaskBarDisplayed(object sender, EventArgs e)
{
    this.Show();
    //this.WindowState = WindowState.Maximized;
    this.BringToFront();
    var window = this.ParentOfType<Window>();
    window.ShowInTaskbar = true;
    window.Title = "Template Editor (Printing)";
}


LoadDictionary()
private void LoadDictionary(Stream tdfFileStream)
{
    RadDictionary dictionary = new RadDictionary();
    dictionary.Load(tdfFileStream);
    ((DocumentSpellChecker)this.radRichTextBox1.SpellChecker).AddDictionary(dictionary, CultureInfo.CurrentUICulture);
 
}

I can get the window to load and radrichtextbox to show providing I do one of the following:
  1. Comment out LoadDictionary() method call   (loads RadWindow with a taskbar icon but doesn't change dictionary)
  2. Comment out the code that creates an instance of RadWindowHelper2   (loads RadWindow without a taskbar icon but does change dictionary to en-GB)

For some reason I cannot get both of the above methods to load together.

Here's the exception and stack trace when I try to show a taskbar icon and change the dictionary to en-GB:

Exception:
NullReferenceException was unhandled

Object reference not set to an instance of an object.

stack trace:

call stack:
Telerik.Windows.Documents.dll!Telerik.Windows.Documents.UI.Layers.DecorationUILayerBase.UpdateViewPort(Telerik.Windows.Documents.UI.Layers.UILayerUpdateContext context = {unknown})
Telerik.Windows.Documents.dll!Telerik.Windows.Documents.UI.Layers.TextDecorationLayers.ProofingErrorsDecorationUILayer.ForceUpdateUIViewPort()
Telerik.Windows.Documents.dll!Telerik.Windows.Documents.UI.DocumentPagePresenter.UpdateProofingTextDecoration()
Telerik.Windows.Documents.dll!Telerik.Windows.Documents.UI.DocumentPrintLayoutPresenter.UpdateProofingTextDecoration()
Telerik.Windows.Documents.dll!Telerik.Windows.Controls.RadRichTextBox.InvalidateProofingErrors(bool invalidateIncorrectWordsOnly = {unknown})
Telerik.Windows.Documents.dll!Telerik.Windows.Controls.RadRichTextBox.spellChecker_DataChanged(object sender = {unknown}, System.EventArgs e = {unknown})
Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Proofing.DocumentSpellChecker.OnDataChanged()
Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Proofing.DocumentSpellChecker.AddCustomDictionary(Telerik.Windows.Documents.Proofing.ICustomWordDictionary customDictionary = {unknown}, System.Globalization.CultureInfo culture = {unknown})
Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Proofing.DocumentSpellChecker.AddDictionary(System.Lazy<Telerik.Windows.Documents.Proofing.IWordDictionary> lazyDictionary = {unknown}, System.Globalization.CultureInfo culture = {unknown})
Telerik.Windows.Documents.dll!Telerik.Windows.Documents.Proofing.DocumentSpellChecker.AddDictionary(Telerik.Windows.Documents.Proofing.IWordDictionary dictionary = {unknown}, System.Globalization.CultureInfo culture = {unknown})
> TemplateEditor.exe!TemplateEditor.Editor2.LoadDictionary(System.IO.Stream tdfFileStream = {unknown})
TemplateEditor.exe!TemplateEditor.Editor2..ctor(int _userID = {unknown})
TAS2.exe!TAS2.SpecEditor.btnTemplateEditor_Click(object sender = {unknown}, System.Windows.RoutedEventArgs e = {unknown})
[External Code]


Any advice would be greatly appreciated.

Thanks,

Rob



Robert
Top achievements
Rank 1
 answered on 29 Nov 2012
0 answers
208 views
Hi There,

first i want to explain to you what i want, than how i solved it and finally what my problem is.

I was looking for a SelectionChangedEvent on a GridViewComboBoxColumn because based on the selection i have to calculate another property of my "RowItem".
e.g. A user change the value in my first column ( a GridViewComboBoxColumn ), so the value in column no 3 has to be calculated.

Because i didn't find an event, which i can use.

I created my own column, it work mostly:

public class ComboBoxColumn : GridViewBoundColumnBase
  {
   ######################shorted##############################
 
    public event SelectionChangedEventHandler SelectionChanged;
 
    private void OnSelectionChanged( object sender, SelectionChangedEventArgs e )
    {
      var myEvent = this.SelectionChanged;
      if( myEvent != null )
      {
        myEvent( this,
                 e );
      }
    }
 
    private void ComboBoxSelectionChanged( object sender, SelectionChangedEventArgs e )
    {
      this.OnSelectionChanged( sender,e );
    }
     
     ######################shorted##############################
 
    public override FrameworkElement CreateCellEditElement( GridViewCell cell,
                                                            object dataItem )
    {
      this.BindingTarget = RadComboBox.SelectedValueProperty;
      var comboBox = new RadComboBox
        {
          ItemsSource = this.ItemsSource,
          DisplayMemberPath = this.DisplayMemberPath,
          SelectedValuePath = this.SelectedValuePath
        };
      comboBox.SelectionChanged += this.ComboBoxSelectionChanged;
      comboBox.SetBinding( this.BindingTarget,
                           this.CreateValueBinding( ) );
      return comboBox;
    }

My problem is now that i am unable to get the row item in my gridview to set the property for the third column.
Can somebody helps me by this issue? Or is it the wrong why to solve this problem?

Many thanks in advance for your cooperation


Mark
Top achievements
Rank 1
 asked on 29 Nov 2012
4 answers
209 views
My tileView has tileItems that have an image thumbnail along with other things. The process that loads these images is a time-taking process. I want to load the image thumbnails only if the Tile item is within the viewable area. So if my current viewarea shows 50 tile items out of 100 tile items, I want to load the images for only those 50 that are visible. When the user scrolls the tileview and other tileitems come into view, then I want to load the images for these tileitems too.

Is there any event that I can use, to call my load image code....maybe something like tileitem post rendering or something.
I will be grateful for any code samples.
Thanks,
Subarna
Chris
Top achievements
Rank 1
 answered on 29 Nov 2012
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
NavigationView (Hamburger Menu)
Wizard
ExpressionEditor
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
Callout
PasswordBox
SplashScreen
Localization
Rating
Accessibility
CollectionNavigator
AutoSuggestBox
Security
VirtualKeyboard
HighlightTextBlock
TouchManager
StepProgressBar
Badge
OfficeNavigationBar
ExpressionParser
CircularProgressBar
SvgImage
PipsPager
SlideView
AI Coding Assistant
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?