Telerik Forums
UI for WPF Forum
0 answers
412 views
Fairly new to MVVM and learing as I go.  A little stuck on the proper usage of
Telerik.Windows.Controls DelegateCommand
.  I have the below set up, which compiles, however I am more concerned with, whether, I am using it correctly.  I have searched the Online Doc for a while now and couldn't find any examples.

Particularly, I am confused as how I would use the CanSaveAuthorization, or the underlying CanExecute, and what I would do with the object parameter that is required.

Thanks,

    

public class CreateAuthorizationViewModel : ViewModelBase
    {
        private Authorization authorization;
        private AuthorizationRepository authorizationRepository;
        private DelegateCommand saveAuthorizationCommand;
        public DelegateCommand SaveAuthorizationCommand
        {
            get
            {
                return saveAuthorizationCommand;
            }
        }
  
        public CreateAuthorizationViewModel()
        {
            InitializeCommand();
        }
        private void InitializeCommand()
        {
            saveAuthorizationCommand = new DelegateCommand(SaveAuthorization, CanSaveAuthorization);          
        }
  
        private void SaveAuthorization(object parameter)
        {
            authorizationRepository.Save();
        }
        private bool CanSaveAuthorization(object parameter)
        {
                  //I would have validation logic here
            return true;
        }
    }
Patrick
Top achievements
Rank 2
 asked on 01 Feb 2013
1 answer
99 views

This is the border of the RadPropertyGrid with Expression_DarkTheme :

http://img163.imageshack.us/img163/4715/capturemft.png 

I want to apply the same border at a Rectangle.

rect = new Rectangle();
rect.Stroke = Brushes.?;

But i don't know what brushes to use...

Thanks for your help !

Ivan Ivanov
Telerik team
 answered on 01 Feb 2013
5 answers
212 views
Hi,

When editing a value in a GridView Cell, I get an exception when pressing Enter. My entered value is accepted however.
I am using Version 2012 Q2 SP1

   at Telerik.Windows.Controls.StyleManager.GetTheme(DependencyObject element) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Controls\Common\StyleManager.cs:line 85
   at Telerik.Windows.Controls.GridView.GridViewCell.get_EditorPresenter() in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\Cells\GridViewCell.cs:line 240
   at Telerik.Windows.Controls.GridView.GridViewDataControl.ValidateCell(GridViewCell cell) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Editing.cs:line 285
   at Telerik.Windows.Controls.GridView.GridViewDataControl.PerformCellValidation(GridViewCell cell) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Editing.cs:line 214
   at Telerik.Windows.Controls.GridView.GridViewDataControl.CommitCellEdit(GridViewCell currentCell, Boolean isLeavingRow) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Editing.cs:line 60
   at Telerik.Windows.Controls.GridView.GridViewDataControl.CommitEdit() in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Editing.cs:line 1105
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnCommitEditCommand(Object sender, ExecutedRoutedEventArgs e) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Commands.cs:line 298
   at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
   at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
   at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
   at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
   at System.Windows.Input.RoutedCommand.Execute(Object parameter, IInputElement target)
   at Telerik.Windows.Controls.GridView.GridViewDataControl.ExecutePendingCommand() in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.Commands.cs:line 73
   at Telerik.Windows.Controls.GridView.GridViewDataControl.PendAndExecuteCommands(KeyEventArgs e) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 3940
   at Telerik.Windows.Controls.GridView.GridViewDataControl.OnKeyDown(KeyEventArgs e) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Controls\GridView\GridView\GridView\GridViewDataControl.cs:line 3913
   at System.Windows.UIElement.OnKeyDownThunk(Object sender, KeyEventArgs e)
   at System.Windows.Input.KeyEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
   at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
   at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
   at System.Windows.Interop.HwndSource.TranslateAcceleratorCore(MSG& msg, ModifierKeys modifiers)
   at System.Windows.Interop.HwndSource.System.Windows.Interop.IKeyboardInputSink.TranslateAccelerator(MSG& msg, ModifierKeys modifiers)
   at System.Windows.Forms.Integration.ElementHost.ProcessCmdKey(Message& msg, Keys keyData)
   at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
   at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
   at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
   at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FPreTranslateMessage(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at ProjectControl.Program.Main(String[] args) in C:\Users\Marc.Vanhoecke\Documents\Visual Studio 2010\Projects\ProjectControl\ProjectControl\Program.cs:line 31
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

I'm still using the Themes the old way. (telerik:StyleManager.Theme="Windows7") in XAML

Best regards,
Henri
Yordanka
Telerik team
 answered on 01 Feb 2013
1 answer
104 views
I know there are some limitations on pictures, encoding and other things, but would it be possible to show an error message saying it's can't load this pdf?  99% of the files I think will work, but if a client tries to use a file that doesn't load correctly I'd like it to give an error message and say to download the file instead.
Kammen
Telerik team
 answered on 01 Feb 2013
5 answers
409 views
Hi,

in my project I have a method who need parameters and one of them is an object that I want the persistence stream result.
When I call my method, the PersistenceError event handler was called when I try to use the SAVE method of the PersistenceManager and I get the following french error message: Nombre de paramètres incorrects.

Here is the way I call my method:

PersistenceStorage

 

.Persist(MainGrid, ref stream, PersistenceStorage.PersistenceAction.Save, out errMsg);

 



Here is my static object with my method:

static

 

public class PersistenceStorage

 

{


static public bool Persist(object pObject, ref Stream pStream, PersistenceAction pPersistenceAction, out string pErrorMessage)

 

{

mResult =

true;

 

pErrorMessage =

string.Empty;

 

 

PersistenceManager manager = new PersistenceManager();

 

manager.PersistenceError +=

new Telerik.Windows.Persistence.Events.PersistenceErrorEventHandler(manager_PersistenceError);

 

 

try

 

{

 

if (pPersistenceAction == PersistenceAction.Load)

 

{

 

if (pObject != null && pStream != null)

 

{

pStream.Position = 0L;

manager.Load(pObject, pStream);

}

 

else

 

{

mResult =

false;

 

}

}

 

else if (pPersistenceAction == PersistenceAction.Save)

 

{

 

if (pObject != null)

 

{

pStream = manager.Save(pObject);

}

 

else

 

{

mResult =

false;

 

}

}

}

 

catch

 

{

mResult =

false;

 

}

 

finally

 

{

manager.PersistenceError -=

new Telerik.Windows.Persistence.Events.PersistenceErrorEventHandler(manager_PersistenceError);

 

pErrorMessage = mErrorMessage;

}

 

return mResult;

 

}

 


static
void manager_PersistenceError(object sender, Telerik.Windows.Persistence.Events.PersistenceErrorEventArgs e)

 

{

mErrorMessage = e.Exception.Message;

mResult =

false;

 

}

 


public
enum PersistenceAction { Load, Save }

 

 


static
private string mErrorMessage;

 

 

static private bool mResult;

 

}

Tina Stancheva
Telerik team
 answered on 01 Feb 2013
3 answers
135 views
Hi

I want to be able to drop a file from the desktop on to an existing row in a RadGridView. (The event handler will then do something with the file and manipulate the data for that specific row, but that isn't relevant for this discussion.)

Can anybody shed some light on how this can be achieved? I have managed to drop a file on the the RadGridView component itsself, but that's not what I want. I need to be able to drop on a specific row (or preferably have the option to drop on the RadGridView also if it doesn't conflict).

I am finding the Telerik documentation about drag and drop (using DragDropManager) hard to figure out since some of the examples just don't work (http://www.telerik.com/help/wpf/dragdropmanager-getting-started.html) and many of the example projects referred to in prior forum solutions seem to use the RadDragAndDropManager which I understand is soon to be obsoleted.

Anybody? 
Nick
Telerik team
 answered on 01 Feb 2013
0 answers
74 views

We are facing a problem while adding steps in Test studio.

When we are working web and wpf at a time we are not a able to add new steps into Wpf test and while adding the code which is lies in Webtest that is deleting.

Please let me know solution for this problem.

Please find the attachment of error message which we are getting while adding steps.

satyanarayana
Top achievements
Rank 1
 asked on 01 Feb 2013
2 answers
143 views
Is there a property like EnableNavigation of asp.net RadCalendar for the WPF RadCalendar?
if not, how can I disable the title navigation's buttons?

thanks.
Ed
Top achievements
Rank 1
 answered on 31 Jan 2013
1 answer
204 views

public override bool RemoveItem(FilterNode node)
{
    return base.RemoveItem(node); // This method call produces the error output below
}

System.Windows.Data Error: 40 : BindingExpression path error: 'Visibility' property not found on 'object' ''DiagramViewModel' (HashCode=33233561)'. BindingExpression:Path=Visibility; DataItem='DiagramViewModel' (HashCode=33233561); target element is 'MyChartShape' (Name=''); target property is 'Visibility' (type 'Visibility')
System.Windows.Data Error: 40 : BindingExpression path error: 'IsSelected' property not found on 'object' ''DiagramViewModel' (HashCode=33233561)'. BindingExpression:Path=IsSelected; DataItem='DiagramViewModel' (HashCode=33233561); target element is 'MyChartShape' (Name=''); target property is 'IsSelected' (type 'Boolean')

I have a shape style that does some binding:

<Style TargetType="views:MyChartShape" x:Key="MyShapeStyle">
        <Setter Property="Visibility" Value="{Binding Visibility, Mode=TwoWay}" />
        <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />


Probably not critical, but I believe these errors could indicate a performance issue. The node's shape is obviously rendered when it has been removed (along with its DataContext).

Tina Stancheva
Telerik team
 answered on 31 Jan 2013
3 answers
302 views
I want all my RadTabItem views to be built immediately. Currently, the visual tree is built when the tab is selected:

<telerik:RadTabControl
                       IsContentPreserved="True"
                       IsSynchronizedWithCurrentItem="True"

                       SelectedIndex="{Binding CurrentTabIndex}"
                       DropDownDisplayMode="Visible" IsTabStop="True">
  <telerik:RadTabItem Header="A" IsSelected="True">
    <views:MyView1 />
  </telerik:RadTabItem>
  <telerik:RadTabItem Header="B">
    <views:MyView2 />
  </telerik:RadTabItem>
  <telerik:RadTabItem Header="C">
    <views:MyView3 />
  </telerik:RadTabItem>
</telerik:RadTabControl>

I want all tabs, "A", "B" and "C", to be created immediately. (This is essential for one very complex problem that I'm trying to solve here.)
Hristo
Telerik team
 answered on 31 Jan 2013
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)
WatermarkTextBox
DesktopAlert
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?